I have a RPi running Raspbian 10 (Buster) that cannot reach the internet after reboot. This unit provides all DNS services for the internal network, and had been working before the ISP router (which supplies DHCP services) was replaced. But now it cannot reach internet after a reboot. Just what configuration of the router needs to be changed remains a mystery, but I think the underlying problem should be fixed anyway. Here are the details:
The key to this problem seems to be around the default route, which looks like this:
dennis@rpi-gw:/home/dennis> route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
0.0.0.0 192.168.1.254 0.0.0.0 UG 1024 0 0 wlan0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
192.168.1.254 0.0.0.0 255.255.255.255 UH 1024 0 0 wlan0
The actual default route should be 192.168.1.254 - the .1.1 address is currently unoccupied. Unless/until this route is changed, the system cannot reliably (or at all?) reach outside the network. Looking around internet, I see references to /etc/network/interfaces and /etc/dhcpcd.conf files that can be manipulated to help... but neither of these files exists on this server.)
I have temporarily band-aided this by adding the following to /etc/rc.local:
route del -net 0.0.0.0 > /dev/null 2>&1 && route del -net 0.0.0.0 > /dev/null 2>&1
route add -net 0.0.0.0 gw 192.168.1.254 dev eth0 2>/dev/null
Of course, that is not an ideal solution but it currently seems to fit the need.
Any suggestions where I might look in order to permanently/properly fix this? Also, any idea why there is no directory/file like /etc/dhcp* ... and there is no file /etc/network/interfaces on this system? What alternative might I be using, and how can I identify which files control networking on this system?
/root> ls -l /etc/dhc* /etc/network
ls: cannot access '/etc/dhc*': No such file or directory
/etc/network:
total 8
drwxr-xr-x 2 root root 4096 Mar 31 22:01 if-post-down.d
drwxr-xr-x 2 root root 4096 Mar 31 22:01 if-pre-up.d
OS details and various config outputs:
/root> 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
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
/root> ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.202 netmask 255.255.255.0 broadcast 192.168.1.255
ether dc:a6:32:47:16:c2 txqueuelen 1000 (Ethernet)
RX packets 825553 bytes 82696283 (78.8 MiB)
RX errors 0 dropped 148038 overruns 0 frame 0
TX packets 22864 bytes 2327918 (2.2 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
loop txqueuelen 1000 (Local Loopback)
RX packets 722 bytes 67370 (65.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 722 bytes 67370 (65.7 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.229 netmask 255.255.255.0 broadcast 192.168.1.255
ether dc:a6:32:47:16:c3 txqueuelen 1000 (Ethernet)
RX packets 269082 bytes 32978861 (31.4 MiB)
RX errors 0 dropped 136089 overruns 0 frame 0
TX packets 2724 bytes 378756 (369.8 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
root> ip a
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
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether dc:a6:32:47:16:c2 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.202/24 brd 192.168.1.255 scope global eth0
valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen
1000
link/ether dc:a6:32:47:16:c3 brd ff:ff:ff:ff:ff:ff
inet 192.168.1.229/24 brd 192.168.1.255 scope global dynamic wlan0
valid_lft 597568sec preferred_lft 597568sec
UPDATE with information from comments:
I admit I installed this myself, and changed the default networking configuration to more closely match my many years experience with linux systems, but I can't now find the steps. I will maybe reload on a different RPi device. As far as wanting the wlan configuration, that is not the case. That configuration has the correct gateway and eth does not. THAT is the problem I need to solve. I would MUCH prefer to work only with ethernet. I may do the bridge you suggested (which just looks like more overhead to me) or deconfigure wifi when working.
I know there is no magic. How can I identify what the configured networking solution is (NetworkManager, ...), and follow down a path assured that I know what I'm dealing with? I don't follow all the details behind the changes that are introduced with each new release, and (OK, call me old, but...) the ones that have worked for me for years are the ones I try to stick with. Default networking solutions change, SYSVINIT <-> SystemD changes... systemctl versus service ... all these things just muddy the waters for someone just trying to keep systems running but up to date.
As mentioned originally, the route is completely wrong on the eth0 network, pointing to a default gateway that does not exist and has never been.
any idea why there is no directory/file like /etc/dhcp* ... and there is no file /etc/network/interfaces on this system?
- did you remove them? what is "this system" ... stock standard Raspberry Pi OS? what about/etc/NetworkManager
- anything there? – Jaromanda X Jun 30 '21 at 02:20