Using the WebServer example file I have been able to confirm that my arduino is connected to my local network and I can open the page in my browser. However any attempt at contacting addresses outside my own network fails. For example this simple script:
#include <SPI.h>
#include <Ethernet.h>
EthernetClient client;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
IPAddress ip(192, 168, 1, 25);
IPAddress gateway(192, 168, 1, 1);
IPAddress dns(8, 8, 8, 8);
byte server[] = { 64, 233, 187, 99 }; // Google
void setup() {
Ethernet.begin(mac, ip, dns, gateway);
Serial.begin(9600);
delay(1000);
Serial.println(Ethernet.localIP());
}
void loop() {
if (client.connect(server, 80)) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}
This consistently returns connection failed
. The ethernet cable in the arduino has an active internet connection, albeit via a switch. My board is an arduino uno.