WAN IPv4 interface gets local IP upon first boot and restart

I recently switched to a new ISP (Monkeybrains) which allows connecting WAN via DHCP without a modem. However, upon first boot I get a local IP on the WAN IPv4 interface (the wan6 interface is unaffected). This is not resolved until running ifup wan or service network restart, and after restarting the interface again it reverts back to a local IP. How should I work around this?

Network config:

config interface 'loopback'
	option device 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config globals 'globals'
	option packet_steering '1'
	option ula_prefix 'fdff:e93d:66d7::/48'

config device
	option name 'br-lan'
	option type 'bridge'
	list ports 'eth0'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	option ipaddr '10.1.0.1'
	option netmask '255.255.255.0'
	option ip6assign '60'

config interface 'wan'
	option device 'eth0.2'
	option proto 'dhcp'
	option peerdns '0'
	list dns '9.9.9.9'
	list dns '149.112.112.112'

config interface 'wan6'
	option proto 'dhcpv6'
	option device 'eth0.2'
	option ip6ifaceid 'random'
	option peerdns '0'
	option reqaddress 'try'
	option reqprefix 'auto'
	list dns '2620:fe::fe'
	list dns '2620:fe::9'

Example behavior:

root@OpenWrt ~# udhcpc -i eth0.2
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 192.168.88.252, server 192.168.88.1
udhcpc: lease of 192.168.88.252 obtained from 192.168.88.1, lease time 600
udhcpc: ip addr add 192.168.88.252/255.255.255.0 broadcast + dev eth0.2
udhcpc: setting default routers: 192.168.88.1
root@OpenWrt ~# udhcpc -i eth0.2
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 170.XX.XXX.XXX, server 208.69.43.18
udhcpc: lease of 170.XX.XXX.XXX obtained from 208.69.43.18, lease time 3601
udhcpc: ip addr add 170.XX.XXX.XXX/255.255.255.0 broadcast + dev eth0.2
udhcpc: setting default routers:170.XX.XXX.1

# Restarting the interface again reverts back to local IP

root@OpenWrt ~# udhcpc -i eth0.2
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 192.168.88.252, server 192.168.88.1
udhcpc: lease of 192.168.88.252 obtained from 192.168.88.1, lease time 600
udhcpc: ip addr add 192.168.88.252/255.255.255.0 broadcast + dev eth0.2
udhcpc: setting default routers: 192.168.88.1
root@OpenWrt ~# udhcpc -i eth0.2
udhcpc: started, v1.36.1
udhcpc: broadcasting discover
udhcpc: broadcasting select for 170.XX.XXX.XXX, server 208.69.43.18
udhcpc: lease of 170.XX.XXX.XXX obtained from 208.69.43.18, lease time 3601
udhcpc: ip addr add 170.XX.XXX.XXX/255.255.255.0 broadcast + dev eth0.2
udhcpc: setting default routers:170.XX.XXX.1

Is there any device in your network with IP 192.168.88.1? This looks like an ISP problem. (Note that 192.168.88.1 is the default IP for Mikrotik equipment.)

The first assignment has a lease time of 600 seconds (10 minutes). OpenWrt will attempt to renew it at half the lease time, or 5 minutes. If you wait for that, does the problem resolve?

Running udhcpc manually is likely to result in multiple of instances of udhcpc attached to the interface. Use service network restart to restart networking cleanly.

2 Likes

Check dmesg for random MAC being assigned, at least docsis gives dhcp and NAT subnet if your MAC changes, like to save you from unintentionally bridging LAN to internet.

Is there any device in your network with IP 192.168.88.1? This looks like an ISP problem. (Note that 192.168.88.1 is the default IP for Mikrotik equipment.)

Oh interesting. There aren't any within my network, but I noticed Monkeybrains is using a Mikrotik device as a switch by the install. I'll try contacting them.

The first assignment has a lease time of 600 seconds (10 minutes). OpenWrt will attempt to renew it at half the lease time, or 5 minutes. If you wait for that, does the problem resolve?

I waited for a full ten minutes and it didn't resolve without restarting the network.

Confirming this was an ISP issue. Monkeybrains swapped out the device they were using by the install and it's now resolved with the same config on my end posted above.

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