Beginner Question - Connecting Ethernet Shield

Hey all
i just purchased an authentic ethernet shield for the arduino

i have followed several tutorials to the t and have not been able to get the arduino ethernet shield to connect

here are the only lines i changed from the example code for ethernet client

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 103 }; // local address for ethernet shield
byte server[] = { 66, 249, 91, 104 }; // Google - ping as of June 6 2010

the serial response

connecting...
connection failed

disconnecting.

i have tried assigning different IPs for the shield

my setup

  1. linksys wrt54g (in another room)
  2. vista 32
  3. arduino 0018
  4. ethernet shield (rj45) connected to the ethernet on pc
  5. pc is using wireless for connection to router

i am stuck, and would appreciate any help

Probably best to post your whole client code so others can test it. I've got an arduino with the Wiznet W5100 shield, and both client and server code works ok. Try a header like below:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 103 };
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte server[] = { 66, 249, 91, 104 }; // Google

It looks like you're missing the gateway IP address.

this is the tutorial i was referencing
simple connection test

in which they don't use the subnet and gateway?

the shield itself is the official arduino one with W5100

i have tried the above code with the subnet and gateway, but i don't believe that my issue is
the arduino side of things but rather my network setup at home

to clarify
my pc has a onboard wifi which i use for connecting to my connection and the arduino shield i have attempted to use the rj45 (do i need a crossover?)
additionally i have turned on my telnet in vista

if you are connecting directly to another PC's available RJ45, you need a crossover cable. When connecting to a network via hub or switch... you do not need one.

Here is the general rule of thumb... in Ethernet networks, you have both hosts and network gear. When connecting dissimilar devices... hosts to network gear, you use a straight cable... when connecting "similar" devices like host-to-host or switch-to-switch, you need a crossover.

Here is a concern... you seem to be using a spare port on you PC. I don't use VISTA, but the way I see it, it will not work the way you think it will.

The additional RJ45 is NOT on the same network as wireless... so you need to bridge them by enabling "routing". You need to give the RJ45 an new network assignment (like 192.168.2.1) and your shield needs to be in that network... When the Shield can talk to the PC's RJ45, you should be almost there. You would then manually enable routing... or use Internet Connection Sharing to allow the PC's RJ45 to use the Wireless connection to the Internet.

Of course, this is only true if I sort of understand what you are trying to do. (and I may be way off...)

thank you kindly
picking one up today

picked one up (live a block away from an electronics shop)
confirmed! all works well!

thanks again pwillard

when connecting "similar" devices like host-to-host or switch-to-switch, you need a crossover

You don't need a crossover on most modern switches, they usually autodetect and just work. The advice on connecting hosts and NICs stands.

I had the same problem, I figured out that the google server was refusing the connection, so i try with another ip from google, and it worked.

I am also having a same problem. I have connected the shield to my router via Ethernet cable and I assigned an ip address of 192.168.1.107 which has not been assigned to any device in my network. I tried to execute same example code and I am having same problem as 32teeth. I have no idea what shall I do. I changed the server IP addresses for google { 74, 125, 67, 104 } and { 66, 249, 91, 104 } //Google) but it didn't work either. I am kind of stuck. Any help would be appreciated...

Thank you all in advance- this is a great forum.

Here is my code for an ethernet Client- the Colision LED is lite and i can't see the ethernet connection on my LAN. I am using Wireshark to look at the LAN. My goal is to get the Arduino to pass data to the Internet via UDP. I have the latest EtherShield with SD and Wiz chip, which has a full TCP-IP stack on it I believe. YES, I am a Noob learning EE, Networking and C++ all at once to build my prototype- yikes. :-[

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

byte mac[] = { 0x90, 0xa2, 0xda, 0x00, 0x1d, 0xb8 };
byte ip[] = { 192, 168, 1, 104 };
byte gateway[] = { 192, 168, 1, 1 }; // internet access via router
byte subnet[] = { 255, 255, 255, 0 }; //subnet mask
byte server[] = { 66, 249, 91, 104 }; // Google

Client client(server, 80);

void setup()
{
Ethernet.begin( mac, ip, gateway, subnet );
Serial.begin(9600);

delay(1000);

Serial.println("connecting...");

if (client.connect()) {
Serial.println("connected");
client.println("GET /search?q=arduino HTTP/1.0");
client.println();
} else {
Serial.println("connection failed");
}
}

void loop()
{
if (client.available()) {
char c = client.read();
Serial.print(c);
}

if (!client.connected()) {
Serial.println();
Serial.println("disconnecting.");
client.stop();
for(;:wink:
;
}
}

You can try the below to see if you get a reply. Change the IP address assigned to the arduino as needed.

//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 to see what the arduino receives

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

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 102 };
byte server[] = { 208, 104, 2, 86 }; // zoomkat

Client client(server, 80);

void setup()
{
  Ethernet.begin(mac, ip);
  Serial.begin(9600);
  Serial.println("starting simple arduino client test");
  Serial.println();
  
  delay(1000);
  
  Serial.println("connecting...");
  
  if (client.connect()) {
    Serial.println("connected");
    client.println("GET /~shb/arduino.txt HTTP/1.0");
    client.println();
  } else {
    Serial.println("connection failed");
  }
}

void loop()
{
  if (client.available()) {
    char c = client.read();
    Serial.print(c);
  }
  
  if (!client.connected()) {
    Serial.println();
    Serial.println("disconnecting.");
    client.stop();
    for(;;);
  }
}