I've encountered a situation where the DHCP-address does not stay on the interface when the MAC address changes during bridge setup.
The default route leaves as well. No replacements are added even though there's a new DHCP lease.
The behaviour is reproducible (/etc/init.d/network restart
or reboot
behave the same).
For the test, openwrt trunk (f57230c4e6ee5af36d22bc0bef0bf7adc583c5b0) is used.
Fixing the MAC address resolves the issue. This post describes the error, the next post describes the workaround.
I've chosen not to obfuscate the MAC addresses.
These are address and routes on the openwrt device in the non-working state:
[root@50024 ~] $ ip a show br-n_1
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 02:fe:ed:3b:29:8f brd ff:ff:ff:ff:ff:ff
inet6 2002:5476:3f1:0:12fe:edff:fe3b:2990/64 scope global dynamic noprefixroute
valid_lft 7155sec preferred_lft 3221sec
inet6 fe80::12fe:edff:fe3b:2990/64 scope link
valid_lft forever preferred_lft forever
[root@50024 ~] $ ip r show table 1
[root@50024 ~] $
IPv6 works normally.
config interface 'n_1'
option force_link '1'
option stp '1'
option bridge_empty '1'
option proto 'dhcp'
#option macaddr '10:fe:ed:3b:29:90'
list ifname 'eth0.1'
list ifname 'eth0.2'
list ifname 'bat0'
option type 'bridge'
option ip4table '1'
option ip6table '1'
Times are wonky at boot. Power up was at 21:17:something.
Note the changing IP and the bind(UDP): Address not available
.
[root@50024 ~] $ logread | grep udhcp
Fri May 1 20:33:30 2020 daemon.notice netifd: n_1 (1639): udhcpc: started, v1.31.1
Fri May 1 20:33:36 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending discover
Fri May 1 20:33:36 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 20:33:36 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending discover
Fri May 1 20:33:36 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 20:33:36 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending discover
Fri May 1 20:33:39 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending select for 192.168.0.26
Fri May 1 20:33:39 2020 daemon.notice netifd: n_1 (1639): udhcpc: lease of 192.168.0.26 obtained, lease time 864000
Fri May 1 21:18:58 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 21:18:58 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending renew to 192.168.0.1
Fri May 1 21:18:58 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 21:18:58 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending select for 192.168.0.79
Fri May 1 21:18:58 2020 daemon.notice netifd: n_1 (1639): udhcpc: lease of 192.168.0.79 obtained, lease time 864000
Fri May 1 21:19:05 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 21:19:05 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending renew to 192.168.0.1
Fri May 1 21:19:05 2020 daemon.notice netifd: n_1 (1639): udhcpc: bind(UDP): Address not available
Fri May 1 21:19:05 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending renew to 0.0.0.0
Fri May 1 21:19:05 2020 daemon.notice netifd: n_1 (1639): udhcpc: lease of 192.168.0.79 obtained, lease time 864000
Fri May 1 21:19:06 2020 daemon.notice netifd: n_1 (1639): udhcpc: performing DHCP renew
Fri May 1 21:19:06 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending renew to 192.168.0.1
Fri May 1 21:19:06 2020 daemon.notice netifd: n_1 (1639): udhcpc: bind(UDP): Address not available
Fri May 1 21:19:06 2020 daemon.notice netifd: n_1 (1639): udhcpc: sending renew to 0.0.0.0
Fri May 1 21:19:06 2020 daemon.notice netifd: n_1 (1639): udhcpc: lease of 192.168.0.79 obtained, lease time 864000
This is the output of echo "$INTERFACE $@ $ip" ; ip l show "br-$INTERFACE" ; ip -4 a show "br-$INTERFACE"
in /etc/udhcpc.user.
Note that the new address (192.168.0.79) isn't added to the interface:
n_1 deconfig
5: br-n_1: <NO-CARRIER,BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT group default qlen 1000
link/ether 10:fe:ed:3b:29:90 brd ff:ff:ff:ff:ff:ff
n_1 bound 192.168.0.26
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 10:fe:ed:3b:29:90 brd ff:ff:ff:ff:ff:ff
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
inet 192.168.0.26/24 brd 192.168.0.255 scope global br-n_1
valid_lft forever preferred_lft forever
n_1 bound 192.168.0.79
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 02:fe:ed:3b:29:8f brd ff:ff:ff:ff:ff:ff
n_1 renew 192.168.0.79
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 02:fe:ed:3b:29:8f brd ff:ff:ff:ff:ff:ff
n_1 renew 192.168.0.79
5: br-n_1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 02:fe:ed:3b:29:8f brd ff:ff:ff:ff:ff:ff
The subsequent calls proto_send_update seem to have but one effect: remove the first address from the interface.
However, when the lease expires and it's refreshed, the address is configured correctly.