I tried to plug in my E3372h Huawei modem, it was recognised automatically as an eth1, and the route -n showed 192.168.8.1 as default gateway, substituting the 0.0.0.0 default route accordingly (why?). Once I removed it (restart etc etc), it never has the original default 0.0.0.0 anymore.
rpi@rpi:~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.246.238.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
What is happening? Which tool is blocking rpi from setting up correctly the eth0? I know it has to do with the usb dongle and the tool that is picking it up as an eth1 (which no longer exists if i remove it (shutdown , remove and then start rpi). Could it be the fault of usb-modeswitch (which I never touched btw)?
What can I do?
Edit: trying to fix it, I get....
pi@rpi:~ $ sudo route add -net 0.0.0.0 gw 192.168.0.1 dev eth0
SIOCADDRT: Network is unreachable
Edit #2:
This manual entry below makes it work. But how do I find the root cause and I make things automatic once again? I want to have a static IP as per the network manager options (which write to /etc/dchpcd.conf as far as I understand) and then reboot and have all the routes correct again.
i@rpi:~ $ sudo ip route add 192.168.0.0/24 dev eth0
pi@rpi:~ $ sudo route add -net 0.0.0.0 gw 192.168.0.1 dev eth0
pi@rpi:~ $ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.246.238.0 0.0.0.0 255.255.255.0 U 0 0 0 wg0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Edit #3:Version of pi is 3B+ with Buster as OS
i@rpi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
Edit #4:
pi@rpi:~ $ ip a && ip r
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether b8:27:eb:35:e9:89 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.39/24 brd 192.168.0.255 scope global deprecated noprefixroute eth0
valid_lft forever preferred_lft forever
inet6 2a02:xxx:xx:xxx:xxxx:xxxx:xxxx:xxxx/64 scope global dynamic mngtmpaddr noprefixroute
valid_lft 604799sec preferred_lft 604799sec
inet6 fd00::39/128 scope global noprefixroute
valid_lft forever preferred_lft forever
inet6 fe80::d0c9:104e:2eca:3e75/64 scope link
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
link/ether b8:27:eb:60:bc:dc brd ff:ff:ff:ff:ff:ff
4: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN group default qlen 1000
link/none
inet 10.246.238.1/24 scope global wg0
valid_lft forever preferred_lft forever
inet6 fd11:5ee:bad:c0de::1/64 scope global
valid_lft forever preferred_lft forever
10.246.238.0/24 dev wg0 proto kernel scope link src 10.246.238.1
Edit #5:
interface wlan0
inform 192.168.0.38
static routers=192.168.0.1
interface eth0
static routers=192.168.0.1
inform 192.168.0.39
static domain_name_servers=192.168.0.39
static domain_search=192.168.0.39
static ip6_address=fd00::39
interface eth1
inform 192.168.8.100
static routers=192.168.8.1
metric 400
Adding ^the end of the /etc/dchpcd.conf
Seamus it is the pi's behavior. I am asking how to find what blocks the pi from creating the default route from the beginning.
– Nick Dec 10 '23 at 06:39