Problems with the Arduino Ethernet Shield

Today I tried connecting two Arduinos with Ethernet Shields, to be exact arduino leonardo eth clones because it’s not available anymore. I wanted to toggle a boolean via Multicast, both Arduinos should be able to toggle the value on both devices, but they were not able to send packets. The DHCP client does not work either.

The solution to the problem took me several hours of debugging, I tried 4 different Ethernet libraries until I realised that the example that came with the library worked perfectly. I finally narrowed the problem down to the MAC address and did some reading.

I used a MAC address generator out of laziness (although admittedly I would have made the same mistake if I had assigned the address manually). There seem to be two things to look out for with MAC addresses: The first two bits.

The first bit indicates whether it is a group address or an individual one. Of course, the generator spat out two group addresses for me. A group address as sender does not work, so the Arduino did not get an address via DHCP and could not send anything.

The second bit is not quite as critical, but should be set to 1 for random MAC addresses, this implies that it is not a prefix assigned by IANA, but is just “locally unique”.

At this point: Thanks Wikipedia

So if your Arduino with a self generated MAC address

  • does not get an IP via DHCP
  • can not send packets
  • does not receive TCP or UDP packets
  • even with setting a static IP address does not ping
  • but can join multicast groups and receive multicast packets

Just look a bit closer at the mac address.


Be sure to only use MAC adresses that follow this pattern.