Ethernet not working once I open the serial monitor

I created a client ,this is a code that I used for http request

//zoomkat 11-13-10
//simple ethernet client test code
//for use with IDE 0021 and W5100 ethernet shield
//modify the arduino lan ip address as needed
//open serial monitor and push reset button to 
//see what the arduino receives

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

byte mac[] = { 0x90, 0xA2, 0xDA, 0x0D, 0x47, 0xE3 };
byte ip[] = { 192, 168, 1, 177 };
byte server[] = { 208, 104, 2, 86 }; // zoomkat

EthernetClient client;

void setup()
  Ethernet.begin(mac, ip);
  Serial.println("starting simple arduino client test");


  if (client.connect(server,80)) {
    client.println("GET /~shb/arduino.txt HTTP/1.0");
  } else {
    Serial.println("connection failed");

void loop()
  if (client.available()) {
    char c =;

  if (!client.connected()) {

the link and 100Mbs leds turn off once I open the serial monitor , and it displays “connection failed”
reset while uploading or opening serial monitor doesnt work everytime
where is the problem?
any help is appreciated

When you open the serial window, it triggest arduino to reset. That's all I know. I don't have ethernet shield. What if you try this terminal program instead?

You can compile, upload and open serial port with this program, which will not trigger arduino reset.

I copied the code, uploaded it to the arduino. I ran it ten times in a row without issue by opening the serial monitor. Is your router gateway IP address 192.168.1.x?

yes youre right , I added the gateway, and it works fine. 8) thank you for your help , I appreciate it guys