I'm having "problems" with my Rpi 4 connection. Well, more than problems is that I think there's something I don't understand.

So the thing is that I have my Rpi connected to both wired network with eth0 interface and wireless network with the wlan0.

The thing is that the wired connection is a local network to I've made with an old router to communicate my computers but that actually don't have internet access. The internet access of the Rpi is via the wireless connection.

The problem that I have is that when I have the wired connection on the Rpi doesn't reach internet. I think this is because the it chooses as default gateway the one of the wired connection, which has no access to the internet. If I unplug the ethernet cable then the Rpi can access the internet with the wireless connection.

When both networks are on the route table locks like this:

pi@raspberrypi:~ $ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    202    0        0 eth0         UG    303    0        0 wlan0   U     202    0        0 eth0 UH    100    0        0 eth0   U     303    0        0 wlan0

If in this configuration I ping I get:

pi@raspberrypi:~ $ ping raspberrypi.org
PING archlinux.org ( 56(84) bytes of data.
From default ( icmp_seq=1 Destination Net Unreachable
From default ( icmp_seq=2 Destination Net Unreachable
--- raspberrypi.org ping statistics ---
2 packets transmitted, 0 received, +2 errors, 100% packet loss, time 2ms

however, if I ping when only the wireless is connected I get:

pi@raspberrypi:~ $ ping raspberrypi.org
PING raspberrypi.org ( 56(84) bytes of data.
64 bytes from ( icmp_seq=1 ttl=49 time=146 ms
64 bytes from ( icmp_seq=2 ttl=49 time=145 ms
64 bytes from ( icmp_seq=3 ttl=49 time=176 ms
--- raspberrypi.org ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 4ms
rtt min/avg/max/mdev = 144.969/155.480/175.623/14.254 ms

I would like to know how I can make it so that the system chooses the connection gateway to the internet that actually has connection to the internet, or to be able to choose the wireless network over the wired to connect to the internet.

I would like, if possible, to do it without having to touch the dhcpcd.conf file and having to set a static IP.

Thanks a lot!


1 Answer 1



interface eth0

to the /etc/dhcpcd.conf

See Prevent dhcpcd from configuring a gateway on an interface in How to set up networking/WiFi

  • Thank you very much! That worked. I learned about the metric of the connection and to change it so that the network manager assigns the first default gateway to the lower metric value
    – ILA
    Jun 24, 2020 at 8:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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