Can connect to Arduino until it is reset (W5100 Ethernet shield)

I am learning to use the ethernet W5100 shield for Arduino, I am trying to connect using a terminal in telnet mode, I am able to connect and send text from the Arduino to the terminal, when I reset the Arduino I am no longer able to connect to the Arduino with the terminal until I upload a sketch with a different IP defined.

For example:
I use the IP then I connect to the Arduino with the terminal and it works, I reset the Arduino and it stops working, I then upload a sketch with a different IP defined and it starts working again until the Arduino is reset again. Anybody know how to fix this?

Can you please post your code. In the IDE, use edit → copy for forum. Next post it in a reply here.

@sterretje Here is the code:

#include <SPI.h>
#include <Ethernet.h>

byte mac[] = {
  0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 177);

EthernetServer server(23);
boolean alreadyConnected = false;

void setup() {
  if(Ethernet.begin(mac) == 0){
    Serial.print("Could not connect with DHCP")


  Serial.print("Server address: ");

void loop() {
  EthernetClient client = server.available();
    if (!alreadyConnected) {
      client.println("Hello, client!");
      alreadyConnected = true;

Nevermind, I figured out that my router was rejecting the IP so I set the router to accept DHCP so it works now

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.