Weird DHCP issue


#1

Our device is made up of STM32 + W5500. While I was testing them, I had a weird DHCP issue.
I connect 1st device to a router, everything works fine. Then, I connect 2nd device to the same router with the 1st device already connected. 2nd device could not get the ip from the router’s dhcp server.
I remove both devices from the router. connect only 2nd device to the router. 2nd device still cannot get the ip. I connect 2nd device to a different router, 2nd device can get the ip from the router’s dhcp server. after that, I connect 2nd device back to original router, 2nd device still cannot get the ip.

here is the wireshark log for 2nd device (original router)
1871 242.090412 0.0.0.0 255.255.255.255 DHCP 590 DHCP Discover - Transaction ID 0x12345678
1872 242.105096 192.168.0.1 255.255.255.255 DHCP 590 DHCP Offer - Transaction ID 0x12345678
2026 252.091534 0.0.0.0 255.255.255.255 DHCP 590 DHCP Discover - Transaction ID 0x12345678
2027 252.106616 192.168.0.1 255.255.255.255 DHCP 590 DHCP Offer - Transaction ID 0x12345678
I added some debug info to the code, and from the debug output, it looks like W5500 does not received the DHCP Offer. As a result, it doesn’t send the DHCP Request. From the wireshark, DHCP offer was broadcasted from the router’s dhcp server.

here is the wireshark log for 2nd device (another router)
112 15.967901 0.0.0.0 255.255.255.255 DHCP 590 DHCP Discover - Transaction ID 0x12345678
114 16.966301 192.168.85.1 255.255.255.255 DHCP 347 DHCP Offer - Transaction ID 0x12345678
115 16.967888 0.0.0.0 255.255.255.255 DHCP 590 DHCP Request - Transaction ID 0x12345678
116 16.971901 192.168.85.1 255.255.255.255 DHCP 347 DHCP ACK - Transaction ID 0x12345678

Any ideas? Please help!
Cody


#2

You must attach Wireshark logs, not excerpts from it - and better for communication with both routers. I suspect you can compare logs yourself to get an idea what is going wrong for the first router.

You also did not mention what is happening when you connect 2nd device to the first router when router was just rebooted (it does not know about 1st device), and you did not try same scenario as you did with second router).

I assume you ensured that MAC addresses of the devices are different?


#3

one good record and rest bad.zip (211.2 KB)

Attched is the Wireshark log file.

  • 192.168.85.1 is another router IP
  • 192.168.0.1 is original router’s IP
  • when I connected the 2nd device to the first router, it couldn’t get the IP, from debug output, it didn’t receive the DHCP offer packet, wireshark can see DHCP Offer packet though.
  • MAC addresses are from Microchip ethernet chip on the device and you can see “Microchi_ee:dc:bd” from the wireshark log.
  • when 2nd device cannot get IP from original router happened, it looks like permanent. I tried reset the original router, power off and power on, and they do not help. the 2nd device cannot get IP from original router.

Are there anythings I can try or further information I should provide?

Thank you!
Cody


#4

It seems that you use same MAC address for both devices on the same subnetwork. I suspect that in this case all packets will be delivered to the device registered earlier, and second device will not get the replies.

You must ensure that you set different MAC addresses to difference devices.