Ubuntu clients get wrong IP address from openwrt DHCP

Hi everyone

I have a bunch of clients connected via a switch to a network interface on an openwrt router. This is bridged with an AP as well so I can get put in the same network via the AP.

The network interface is configured to hand out IP addresses in the network space 10.0.0.x.

This all has worked fine and just as expected for months. Now yesterday there was a power outage and so everything rebooted. This morning I wake up to find out all the clients in that network (10.0.0.x) which previously had addresses of the form 10.0.0.59, for example, have ended up (and are stuck with) addresses in the 192.168.1.x subnet.

To make this even more bizarre, 192.168.1.x is not a valid ip address for any of the interfaces on the router as currently configured. And nonetheless the clients in the 10.0.0.x subnet all have these addresses and have internet connectivity too through those addresses.

I've enabled dhcp verbosity for dnsmasq on the router. This is what I get:

Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 DHCPDISCOVER(brpriv-lan) 74:56:3c:4e:72:87
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 tags: utumno, brpriv-lan
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 DHCPOFFER(brpriv-lan) 10.0.0.78 74:56:3c:4e:72:87
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 requested options: 1:netmask, 28:broadcast, 2:time-offset, 3:router,
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 requested options: 15:domain-name, 6:dns-server, 119:domain-search,
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 requested options: 12:hostname, 44:netbios-ns, 47:netbios-scope,
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 requested options: 26:mtu, 121:classless-static-route, 42:ntp-server
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 next server: 10.0.0.1
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  1 option: 53 message-type  2
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 54 server-identifier  10.0.0.1
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 51 lease-time  12h
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 58 T1  6h
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 59 T2  10h30m
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option:  1 netmask  255.255.255.0
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 28 broadcast  10.0.0.255
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option:  3 router  10.0.0.1
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option:  6 dns-server  10.0.0.1
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  3 option: 15 domain-name  lan
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 available DHCP range: 10.0.0.5 -- 10.0.0.204
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 client provides name: utumno
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 DHCPREQUEST(brpriv-lan) 192.168.1.175 74:56:3c:4e:72:87
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 DHCPNAK(brpriv-lan) 192.168.1.175 74:56:3c:4e:72:87 wrong server-ID
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 broadcast response
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  1 option: 53 message-type  6
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size:  4 option: 54 server-identifier  10.0.0.1
Sat Jan 27 09:25:04 2024 daemon.info dnsmasq-dhcp[1]: 4135373404 sent size: 15 option: 56 message  77:72:6f:6e:67:20:73:65:72:76:65:72:2d:49...

NOTE 'utumno' is both the name of the client and of the interface, apologies for the confusing names.

I've made the client ask for a new ip with dhclient -r -i <interface> multiple times. Same result. It is stil stuck with this address. Killed all dhclient instances, same thing.

The logs on the server do look correct from logread: the server says the request for 192.168.1.x is in the wrong network and seems to reject it.
But a wireshark sniuff on both the router and the client seems to show they're not understanding each other. Either due to some ambiguity or mis-parsing of the protocol messages on one or the other.

If there another device with a DHCP, in front of your openwrt device ?

Or another device on your LAN, with a DHCP ?

Tried accessing the GW IP of the 192.168.1 subnet, using a browser, or ssh ?

2 Likes

If there another device with a DHCP, in front of your openwrt device ?

there you go...
I had an openwrt image I'd buillt running on a raspberry PI connected to the network that I'd forgotten about. That explains the 192.168.1.x addresses!

i have found the overall solution as well. The dhclient has the following file /var/lib/dhcp/dhclient.leases on ubuntu. I needed to run the following:

sudo rm -rf /var/lib/dhcp/dhclient.leases
sudo dhclient -r -i <interface>
sudo rm -rf /var/lib/dhcp/dhclient.leases
sudo dhclient -i <interface>

and now I got back the old address in 10.0.0.x. Still a little weird, since the raspberry-pi openwrt would've had to issue these DHCP addresses on its WAN, which doesn't make sense (all the ubuntu clients are LAN neighbors of the PI). Would need to look at its configuration. but presumably the router took longer to start up and the oprnwrt-running raspberry-pi kicked in and handed out leases in that gap, is probablky the explanation

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