Multi-homed default route trouble with AutoIP
Mike Crowe
Tue Jul 07 14:26:52 2020
I'm having some trouble with a particular configuration on an embedded
Linux device with a v4.9 kernel after upgrading to dhcpcd-9.1.4. This
configuration is unusual, but unfortunately one that I need to deal with.
I have three interfaces all managed by dhcpcd with all options passed on
the command line (I don't believe that it's significant that the interfaces
represent VLANs):
* wlan0: Receives a real IP address and default route via DHCP. This is the
interface I expect my Internet-packets to go out through.
* eth0.6: Has link but nothing else is on the VLAN so the interface
receives a link-local IPv4 address after failing to receive a DHCP
response.
* eth0.15: As eth0.6.
When using dhcpcd-6.11.1 the kernel routing table ends up containing:
default via 192.168.147.1 dev wlan0 src 192.168.147.207 metric 306
169.254.0.0/16 dev eth0.6 proto kernel scope link src 169.254.138.7 metric 204
169.254.0.0/16 dev eth0.15 proto kernel scope link src 169.254.138.7 metric 205
192.168.147.0/24 dev wlan0 proto kernel scope link src 192.168.147.207 metric 306
which works correctly and Internet-bound packets go out via wlan0.
With dhcpcd-9.1.2 and dhcpcd-9.1.4 the kernel routing table looks like:
default dev eth0.6 scope link src 169.254.138.7 metric 204
default dev eth0.15 scope link src 169.254.138.7 metric 205
default via 192.168.147.1 dev wlan0 proto dhcp src 192.168.147.207 metric 306
169.254.0.0/16 dev eth0.6 scope link src 169.254.138.7 metric 204
169.254.0.0/16 dev eth0.15 scope link src 169.254.138.7 metric 205
192.168.147.0/24 dev wlan0 proto dhcp scope link src 192.168.147.207 metric 306
and this means that the kernel unfortunately wants to send Internet-bound
packets out via one of the VLAN interfaces:
# traceroute -n roy.marples.name
traceroute to roy.marples.name (81.108.15.115), 30 hops max, 46 byte packets
1 169.254.138.7 3152.914 ms !H 3119.855 ms !H 3119.976 ms !H
If I delete the eth0.6 and eth0.15 routes:
# ip route del default dev eth0.6
# ip route del default dev eth0.15
then routing seems to be correct again as packets go out via wlan0.
I notice that the IPv6 routing table does not contain any equivalent
routes, and I can connect successfully to IPv6 hosts out on the Internet,
so this problem relates only to IPv4.
So, the question now is whether this is the kernel's fault for attempting
to use the VLAN default routes despite them having link scope or dhcpcd's
fault for adding them? Any enlightenment gratefully received.
Thanks.
Mike.
Archive administrator: postmaster@marples.name