It sounds like you are running out of SRAM and it is causing your code to restart when it overflows (wraps around). Go through your code and use the F() function with your static strings.
Serial.print(F("server is at "));
Serial.println(Ethernet.localIP());