I am using the AT&T Avnet IoT Starter Kit to provide cellular connectivity to my Raspberry Pi 3b+. In order to establish the routing table I added an ip
command to the file /lib/dhcpcd/dhcpcd-hooks/40-route
the command I added was:
ip route add default via 0.0.0.0 dev enx001122334456
(The enx001122334456
is the name of my ethernet device, like eth1
but with a 'predictable name').
This sets the routing table, after booting up I'll have a routing table like:
Dest Gateway Genmask Flags Metric Iface
default 0.0.0.0 0.0.0.0 U 0 enx001122334456
default 0.0.0.0 0.0.0.0 U 0 enx001122334456
default 10.0.0.1 0.0.0.0 UG 303 wlan0
10.0.0.0 0.0.0.0 255.255.255.0 U 303 wlan0
10.0.0.1 0.0.0.0 255.255.255.240 U 221 enx001122334456
10.47.206.96 0.0.0.0 255.255.255.240 U 221 enx001122334456
...
Down here there are a bunch of docker virtual ethernet interfaces and bridge networks
This does exactly what I want it to do for a while, but then it seems to reset (I think it is a changing of the IP addresses that triggers it) and I no longer have my default route. I am using dhcp, so it makes sense that the ip address is changing, but it doesn't make sense that it would have an adverse effect on the routing table. Instead it becomes:
Dest Gateway Genmask Flags Metric Iface
default 0.0.0.0 0.0.0.0 U 0 enx001122334456
default 10.0.0.1 0.0.0.0 UG 303 wlan0
10.0.0.0 0.0.0.0 255.255.255.0 U 303 wlan0
10.0.0.1 0.0.0.0 255.255.255.240 U 221 enx001122334456
10.47.206.96 0.0.0.0 255.255.255.240 U 221 enx001122334456
...
which, although nearly identical, ping 8.8.8.8
doesn't work. Sometimes, even if I specify the interface with ping -I enx001122334456 8.8.8.8
it won't work.
I'm thoroughly confused. I have no idea how to continue debugging this, I just want it to work. Anyone have any knowledge on what could be causing my routing table to reset. Even if you just give me debugging tools or tricks that would be amazing.
/etc/resolv.conf
contains# Generated by resolvconf
- this is normal for virtually alldhcp
clients (includingdhcpcd
). You can change it but it will be overwritten!dhcpcd
is working normally. Exploreresolvconf
if you want to set routing.man dhcpcd
explains this.resolveconf
in its man, but on a high level, what is it doing thatip route
orroute
is not?