Client on LAN randomly assigned WAN/ISP IP address

I recently ran into a weird issue that I cannot figure out. One day, my computer which is connected via Ethernet to my OpenWrt router, was randomly (so far as I can tell) given an IP address directly by my ISP's DHCP (i.e., my external IP address was the one listed on my computer's Ethernet interface -- not a 192.168.1.1/24 one as usual). My computer was able to access the Internet normally, but I could only access the router/default gateway on the LAN (not other devices). I believe this happened after my computer rebooted, but the router had been untouched for months and had not rebooted.

Running ifstatus wan on the router showed that it was down, and I could not ping anything over the WAN. My router config is pretty vanilla, so far as I know, and the cabling was the same as always (i.e., I did not accidentally plug my computer into the modem). The cherry on top is that rebooting fixed the issue, so I cannot interact with the problem anymore. I would still very much like to know what went wrong so this never happens again.

It seems somewhat similar to this issue, but my config had been working for months before this happened.

Let me know which config files to post. Thanks.

Sounds like the router crashed/booted into a state where the switch wasn't [re]initialized. This made it a dumb switch, and hence you got a DHCP from your ISP on WAN...

Odd.

3 Likes

Yes. This sounds right. This exact scenario was possible on the Ubiquiti ER-X for earlier versions of the boot loader which would bring up the switch and before it was fully initialized, it would operate in dumb switch mode for a few seconds. This was fixed on the er-x but updating the boot loader.

Yes, my thought was somehow that the ISP DHCP was leaking through, but I didn't know that the router could fallback to "dumb mode" (sounds like horrible security, but I'm no expert). I can say, though, that the router had been up for 3 months when this issue occurred, but maybe the switch process died (does that even make sense)? The logs are gone from before, but I did save a list of the processes running when the issue occurred (the ps output).

What is the best way to check the status of the switch in case this happens again? And is there anyway to fix it (do I just need to update something)? Thank you for clearing this up.

This topic seems to expound on the above explanation but says the problem is pretty much unavoidable (at least generally speaking at boot time). I would like to know how this might have happened without my router rebooting, but I don't think I have enough information without the logs and without being able to reproduce it.

A simple, but not necessarily comprehensive test would be to take the router and connect two computers

  • one computer connects to the wan
  • one computer connects to the lan
  • both computers set with static IP addresses in the same subnet (for example, 192.168.5.3 and 192.168.5.5, subnet /24)
  • run a ping test from the each PC to the other.
  • reboot or power-cycle the router and see if any of those pings go through while the device is booting.

You might need to do a ping at a much more rapid rate than the standard 1/sec -- maybe something like 10/sec or more.

This will only tell you if the router's built-in switch does come up before it is fully configured and thus operates as a dumb switch and may allow packets to get through unexpectedly. The timing needs to be just right (or wrong) in that it may only be in this state for as short as a few milliseconds or as long as a few seconds.

1 Like

…and an unmanaged switch on on both sides of the router would prevent the computer's interface to go down while the router resets, increasing the chance for your pings to catch any initialization issues with your router's managed switch.

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.