0

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.

1
  • 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? Jun 30 at 2:20
2

First of all: please take note that using /etc/rc.local has limitations due to Compatibility with SysV. We have seen many problems here on this site using it. Following the recommendation of the developers from systemd you should avoid using it.

Then to the configuration files you are looking for. On my default Raspberrypi OS May 7th 2021 with the same contents of /etc/os-release than yours, I get:

rpi ~$ ls -l /etc/dhc* /etc/network
-rw-rw-r-- 1 root netdev 1777 Nov 13  2019 /etc/dhcpcd.conf

/etc/dhcp:
total 16
-rw-r--r-- 1 root root 1426 Nov 18  2018 debug
-rw-r--r-- 1 root root 1735 Nov 18  2018 dhclient.conf
drwxr-xr-x 2 root root 4096 Jun 22 11:55 dhclient-enter-hooks.d
drwxr-xr-x 2 root root 4096 Jun 22 11:58 dhclient-exit-hooks.d

/etc/network:
total 24
drwxr-xr-x 2 root root 4096 May  7 15:44 if-down.d
drwxr-xr-x 2 root root 4096 May  7 15:44 if-post-down.d
drwxr-xr-x 2 root root 4096 May  7 15:44 if-pre-up.d
drwxr-xr-x 2 root root 4096 May  7 15:44 if-up.d
-rw-r--r-- 1 root root  271 May  7 15:44 interfaces
drwxr-xr-x 2 root root 4096 Jan 28  2019 interfaces.d

Obviously you are using a modified Raspberrypi OS. But you should aware that RaspiOS does not use classic Debian ifupdown with configuration in /etc/network/interfaces. Instead it uses dhcpcd with configuration in /etc/dhcpcd.conf.

You show that you have two interfaces eth0 (192.168.1.202/24) and wlan0 (192.168.1.229/24) connected to the same network 192.168.1.0/24. This is not a usual configuration. It is mainly used for redundant network lines to get a failsafe connection but to work properly it needs additional setup with bonding as shown at Howto migrate from networking to systemd-networkd with dynamic failover.

About the routing: the default route with the lowest metric will be first used. So the eth0 connection is used but it seems not work. You show that you only want to use the wlan0 connection. So a very simple solution to your problem is to just unplug the ethernet cable on the port to interface eth0.

If you want to only use the wired connection I can't say much about it because I know nothing about your network setup. But there is a hint that may help. With ip a you found for:

eth0:
    inet 192.168.1.202/24 brd 192.168.1.255 scope global eth0
wlan0:
    inet 192.168.1.229/24 brd 192.168.1.255 scope global dynamic wlan0

The dynamic flag on wlan0 indicates that the interface gets its configuration from a DHCP server. This isn't the case for eth0. It seems eth0 is configured with a local setting maybe statically. Either you reconfigure it to also use a DHCP server or define a default gateway in its local (static?) setup.

5
  • Thanks for your detailed reply @Ingo. 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.
    – Dennis
    Jun 30 at 19:32
  • 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.
    – Dennis
    Jun 30 at 19:39
  • @Dennis You want to use only the wired connection? Why it doesn't work? What's the problem? I would disable the WiFi connection and look what's going wrong with the wired connection.
    – Ingo
    Jun 30 at 20:35
  • I will disable wifi and report back tomorrow. Why it doesnt work…. wasn’t that my question? ;) 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.
    – Dennis
    Jul 3 at 3:10
  • @Dennis I have updated the answer at the end.
    – Ingo
    Jul 3 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.