Arduino Ethernet Shield (W5100) Cannot Access Outside Network

I use the Tomato firmware on my router and it did show up there when I was testing it out. As I said, other networked computers can be connected to without issue.

Well what the heck.

It worked once... Then I tried it again and it didn't work. Weird.

EDIT: I changed the IP and the MAC address and it seemed to work.
Networks love to be picky...

<.................Well what the heck.

It worked once... Then I tried it again and it didn't work. Weird...............>

Same here, wish I could find out why as well....

Connects first time no problems but then it wont connect again either after pushing
reset button or re loading the program...

Sounds like a duplicate IP address on the network.

You may have router issues due to disconnecting/reconnecting the arduino to the router. The router may have to scan for attached and detached clients, which may take some amout of time to complete. I just loaded my code in my arduino and pushed the reset button ~10 times in a row. The appropriate result appeard in the serial monitor each time. I'm using a ~$40 netgear wireless router.

Possibly. I do have an unused router running DD-WRT that I could try.

You don't have gateway / router IP address in your sketch. Without it, getting out can be very hit and miss because the arduino doesn't know where the internet is.

byte gateway[] = { 192, 168, 1, 1 };   //your router's IP address

pluggy:
You don't have gateway / router IP address in your sketch. Without it, getting out can be very hit and miss because the arduino doesn't know where the internet is.

byte gateway[] = { 192, 168, 1, 1 };   //your router's IP address

After resetting it about 10 times and changing the IP address, zoomcat's code now works, though I'm not sure how consistent it will be.

Hmmmmm... really frustrating..
Still can't connect using Zoomcats test program...
Well, to be exact, it connects one out of twenty or more tries.
Same with any of the ethernet example sketches...

I know I have a correct and unused ip address and the mac address is right.
Makes no difference weather I use gateway or not.
I can ping the arduino no problems...

Using latest ethernet board with SD card reader.... using Arduino 0022. on Windows 7

My router is a Netgear supplied by Sky boadband.....

99% of time it hangs for some seconds showing connecting then I just get connection failed.....disconnecting..

Would be very grateful for any further suggestions on this, as far as I can see, the ethernet
board is either faulty or it's the router that's not compatible with this stuff...
Can't try another router as the contract stipulates you can only use the broadband suppliers router...

Thanks for any help

Regards Philip

PhilipT:
Can't try another router as the contract stipulates you can only use the broadband suppliers router...

If your "spare" router is not a modem+router combo, you can always give it a static IP address on its "WAN" port, and interpose it between the Arduino and Sky's router.

You'll need to temporarily change the Arduino to a different subnet (like 192.168.2.*) so your DD-WRT router can have different subnets on its "LAN" and "WAN" sides.

That'll give you more ability to snoop on what's going on, via the DD-WRT tools.

I had a similar problem with the 'official' arduino shield. My symptom was always accompanied by a rapidly flashing Rx LED. When the LED flashed rapidly, the shield would not connect and I had to reset the card until the light flashed "normally". You know, when there actually was traffic on the network? It seems the chip itself can get lost and not establish a connection and there is no indication on the pins to tell the software something is wrong. I'd normally call this a bug in the 5100 software, but I can't prove it.

I hooked a wire to the Rx LED and ran it to a digital pin and counted the flashes in a period of time and reset the ethernet board if there was a faulty connection. This way, by the time I got further into the code the board was working properly. I also check the board from time to time during operation and reset as necessary. The devices can now run for weeks at a time (between power failures) pretty reliably.

However, this may not be your problem. So watch the Rx LED and see if you have similar symptoms. It'll flash in at a consistent rapid rate and never seem to follow the normal traffic pattern of your network.

Had a similar problem here => cause was the MAC address - byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
I guess as this one is used by a zillion sketches ...
Take care that all your duino's use different ones.

Thanks for the responses folks, much appreciated as I'm a bit of a noob with this..
All I wanted was to monitor some temperatures and put the results via ethernet but I've got
stuck at base with this very flaky ethernet board.

Like the idea of a seperate router to stick in the sky box...will try that...
Double checked the mac address and that's ok...

Shame really as the ethernet board wasn't cheap... been hunting around the internet and
my problem is quite common...

Anyhoo, sods law, it's been working fine for an hour this morning but not reliable enough generally.....

Thanks again, onwards and upwards :slight_smile:

Regards
Philip

I pulled out the Arduino out of the drawer today and gave my old code another shot. After some troubleshooting I determined that I could get it to work by generating a new MAC address and changing the IP (I just incremented it by 1). It doesn't always work, but considering it will reliably access computers within my network leads me to believe my router is the problem rather than the shield itself being faulty.

However, it's running DD-WRT and I know that many people are using their DD-WRT routers successfully with their ethernet shields. I would directly connect to my cable modem and try, though it seems like I need to use DHCP in order for it to work.

If I can't get it working, would I be able to run some sort of proxy on my Ubuntu server and have the Arduino routing through that?

This seems to be a common problem - I was using code from Beginning Arduino, with the same problem. So if you haven't solved it yet (and haven't given up trying) or for anyone else trying to solve this....
Someone has already touched on the solution - you need to set up the gateway address and then when you initialise:

Ethernet.begin(mac, ip, gateway)

Then all hopefully will work - did for me after much searching and not a little hair loss. Not sure why all the example out there seem to miss this (and have just Ethernet.begin(mac, ip)) because they don't then seem to work.

Martin

Not sure why all the example out there seem to miss this (and have just Ethernet.begin(mac, ip)) because they don't then seem to work.

The below client code works on my setup without the gateway being used.

//zoomkat 12-08-11
//simple client test
//for use with IDE 1.0
//open serial monitor and send an e to test
//for use with W5100 based ethernet shields

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
byte ip[] = { 192, 168, 1, 102 }; // ip in lan assigned to arduino
//byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
//byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte myserver[] = { 208, 104, 2, 86 }; // zoomkat web page server IP address
//Client client(myserver, 80);  // connect to web server using port 80
EthernetClient client;
//////////////////////

void setup(){

  Ethernet.begin(mac, ip);
  //Ethernet.begin(mac, ip, gateway, subnet);
  Serial.begin(9600); 
  Serial.println("Better client test 12/01/11"); // so I can keep track of what is loaded
  Serial.println("Send an e in serial monitor to test"); // what to do to test
}

void loop(){
  // check for serial input
  if (Serial.available() > 0) //if something in serial buffer
  {
    byte inChar; // sets inChar as a byte
    inChar = Serial.read(); //gets byte from buffer
    if(inChar == 'e') // checks to see byte is an e
    {
      sendGET(); // call sendGET function below when byte is an e
    }
  }  
} 

//////////////////////////

void sendGET() //client function to send/receive GET request data.
{
  if (client.connect(myserver, 80)) {  //starts client connection, checks for connection
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0"); //download text
    client.println(); //end of get request
  } 
  else {
    Serial.println("connection failed"); //error message if no client connect
    Serial.println();
  }

  while(client.connected() && !client.available()) delay(1); //waits for data
  while (client.connected() || client.available()) { //connected or data available
    char c = client.read(); //gets byte from ethernet buffer
    Serial.print(c); //prints byte to serial monitor 
  }

  Serial.println();
  Serial.println("disconnecting.");
  Serial.println("==================");
  Serial.println();
  client.stop(); //stop client

}

Hello,

I have changed my code from 0022 to 1.0 version concerning Ethernet.
Internal (local) netwok: everything works fine. (ping, web-server)
external: Not OK. (e.g smtp client sending mail out).

I've installed wireshark (network sniffer). I saw that Arduino mega was looking for the mac-address of 255.255.255.0.
That is the subnet!!
version 0022 Ethernet.begin(mac, ip, gateway, subnet);
version 1.0 Ethernet.begin(mac, ip, subnet, gateway);

maybe this will help someone.

version 0022 Ethernet.begin(mac, ip, gateway, subnet);
version 1.0 Ethernet.begin(mac, ip, subnet, gateway);

I tested with 1.0 and that seems to be true.

I have just found out the problem at another topic [1] of this forum. The signature of Ethernet.begin method had changed at Arduino 1.0.

Ethernet.begin(mac);
Ethernet.begin(mac,ip);
Ethernet.begin(mac,ip,dns);
Ethernet.begin(mac,ip,dns,gateway);
Ethernet.begin(mac,ip,dns,gateway,subnet);

I hope it can help you too.

Thanks
[1] http://arduino.cc/forum/index.php/topic,95741.msg721801.html#msg721801