WIZnet Developer Forum

W5100 sub-netting problem

I have been experimenting with an Arduino Ethernet shield which has a WIZnet W5100 chip on board. My “lab” setup is a subnet 10.210.210.160/27 which has 30 addresses ranging from .161 to .190 and a subnet mask of 255.255.255.224.

I configured the W5100 with address 10.210.210.188. The router address is 10.210.210.190 and I used the subnet mask as above. The W5100 would not connect to the network. I could not ping the interface and the MAC address was not in the arp table on either my PC or the router. I set up a mirror port on a managed switch and did a Wireshark capture. This showed no activity at all from the W5100. None. I tried using another IP address in the subnet range (10.210.210.187) but got the same result. Since the W5100 does not come with an assigned MAC address, I followed the examples on the Arduino website to construct and apply my own, taking care to avoiding known manufacturers prefixes so as to avoid the possibility of a clash. I puzzled over the problem for quite some time and came to the conclusion that maybe the W5100 had failed.

However, the next day I decided to test the W5100 again using one of the Arduino Ethernet examples (“ChatServer”), this time binding an ordinary class C address to my PC (192.168.4.10, standard class C netmask of 255.255.255.0) and to my pleasant surprise this worked and I could ping the interface which was on 192.168.4.8 with no difficulty. Clearly, the W5100 was still functioning so I then tried my original sketch with another IP address in my subnet range (10.210.210.185) and this time it also worked! I changed this to 10.210.210.187 and then 10.210.210.188 again and no connection. I swapped back to 10.210.210.185 and all was working again.

So what is going on here? I am assuming some kind of problem with the W5100 firmware? If this were only a matter of certain IP addresses not being accessible then it could be accepted as an incorrectly applied subnet mask, possibly at firmware level, but here this interface was not even broadcasting its mac to the router! Since arp sits at a level below IP addressing on the OSI model, this problem would appear to relate to a layer below the protocols for IP addressing, so it is curious that it only seems to affect certain IP addresses in the sub-netted range? How so?

Seems this may have been down to the MAC address that I used. One can’t just choose any octets at random. The first bit of the first byte, when set, signifies this is a broadcast address and my choice of ‘23’ sets this bit. I chose an octet that sets the second bit to signify a private MAC and clears the first bit and my IP address then worked.

Copyright © 2017 WIZnet Co., Ltd. All Rights Reserved.