Arduino with EthernetShield in a switched network?

Hi all,

i’m new to this forum an to the arduino, but not to IT and networking. :wink:

I’ve bougth the arduino and an ethernet shield an took the webserver-example (arduino.cc/en/Tutorial/WebServer]) from the ethernet library. It works fine, as long as the arduino and my pc are connected to the same network-switch. But if i connect the arduino to another switch in our network, i’m no longer able to connect to.

arduino <-> switch <-> pc = ok
arduino <-> switch <-> switch <-> switch <-> pc = no connection

I would like to use the arduino as a network probe for nagios and need to connect it ‘somewhere else’ in our network. What am i ddoing wrong? Or is there an issue with the tcp/ip implementation?

Thanks for help!

Regards from Bonn/Germany

Martin

Did you set the gateway address?

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

http://www.arduino.cc/en/Reference/EthernetBegin

Yes, i did so. Routing between the subnet’s in our intranet works fine. I could do a ping from my pc (172.16.128.213) to the arduino (172.16.18.202) without problems, as long as they are connected to the same switch (not router!).

//Bonn
byte mac[] = { 0x11, 0xAD, 0xBE, 0xEF, 0xFE, 0x22 };
byte ip[] = { 172, 16, 18, 202 };
byte subnet[] = { 255, 255, 0, 0};
byte gateway[] = {172, 16, 0, 1};
...
Ethernet.begin(mac, ip, gateway, subnet);

Any other ideas?

Apart from some ARP caching, I can't think of anything... Perhaps try changing the Arduino's MAC?

ARP is an interesting idea! I'll have a look at this. I did not wonder why Arpwatch did not recognize the arduino - but now i do!

Thanks!

byte mac[] = { 0x11,

This is a multicast address. The first byte in the MAC should be an even number. I suspect one of the switches in the middle is dropping the packet because of this.

-j

Thanks! It seems to be the solution! I changed the mac back to the adress provided with the example:

byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };

an were able to ping an connect the arduino! I think i have to learn a little bit more about mac-adresses...

Regards, Martin

I think i have to learn a little bit more about mac-adresses…

Idem

Here's a summary of ethernet addressing:

0xffffffffffff - the broadcast address. Never use this for an Arduino's MAC.

the two lowest bits of the first byte are special. The lowest bit indicates a unicast or multicast address. If the bit is 1 (i.e. the first byte is an odd number) the address is multicast; if the bit is 0 (first byte is even) the address is unicast. An Arduino MAC should always be unicast.

The second bit indicates local or global administration of the address block. If the bit is 0, the address is globally administered (by IEEE, I think?). If the bit is 1, it is locally administered (assigned by the local network admin). Arduino MACs should have this bit set as 1.

In addition, every MAC address on a LAN must be unique.

-j

Thanks for this! Now i understand...