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.confcontains# Generated by resolvconf- this is normal for virtually alldhcpclients (includingdhcpcd). You can change it but it will be overwritten! – Milliways Jan 08 '19 at 02:20dhcpcdis working normally. Exploreresolvconfif you want to set routing.man dhcpcdexplains this. – Milliways Jan 08 '19 at 02:28resolveconfin its man, but on a high level, what is it doing thatip routeorrouteis not? – Connor McCormick Jan 08 '19 at 16:08ip route add default via 0.0.0.0 dev enx001122334456just add a duplicatedefault 0.0.0.0 0.0.0.0 U 0 enx001122334456that potentially will cause problem. So Im confused that you say that when it was a – MatsK Jan 09 '19 at 18:53