Go Down

Topic: Arduino Ethernet Shield (W5100) Cannot Access Outside Network (Read 5 times) previous topic - next topic


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.

Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)


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 :)



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.



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.

Code: [Select]

//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.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
    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

  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

  client.stop(); //stop client


Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   8)

Go Up