-1

I've installed Ubuntu 23.10 on Micro SD via Raspberry Pi Imager.

To be 100% clear: in the Raspberry Pi Imager v1.8.5, I have clicked at (in the given order) 'Choose OS' > 'Other general-purpose operating systems' > 'Ubuntu' > 'Ubuntu Server 23.10 (64-bit)'.

In the OS customisation settings I've provided my Wifi credentials and booted the Pi succesfully.

The Pi did connect to the Internet via provided Wifi, but it completely ignored the available Ethernet connection. I would expect it would automatically choose the more stable Ethernet over Wifi (that is the standard behaviour of Windows), or it will connect via both with two IPs (that is the standard behaviour of Ubuntu).

  • The cable is not faulty and it works with another computer just fine.
  • The router and its DHCP work fine.
  • The Raspberry Pi has acces to the Internet via Wifi.

How do I force the Pi to connect to Internet via faster and more stable Ethernet, either by switching the Wifi off when Ethernet connection is available, or keeping them both on, but using the Ethernet for egress Internet connection?

1 Answer 1

0

In my case the ip route show revealed that only wlan0 was configured:

default via 192.168.1.254 dev wlan0 proto dhcp src 192.168.1.176 metric 600 
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.176 metric 600 
192.168.1.254 dev wlan0 proto dhcp scope link src 192.168.1.176 metric 600

The systemd-networkd can be used to enable the ethernet and introduce the preferred order of connections:

(1) Create /etc/systemd/network/10-eth0.network via sudo nano /etc/systemd/network/10-eth0.network with the following content for the wired connection:

[Match]
Name=eth0

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
ConfigureWithoutCarrier=yes

[DHCP]
RouteMetric=100

(2) Create /etc/systemd/network/10-wlan0.network via sudo nano /etc/systemd/network/10-wlan0.network with the following content for the wireless connection:

[Match]
Name=wlan0

[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6

[DHCP]
RouteMetric=200

Then enable the systemd-networkd:

sudo systemctl enable systemd-networkd
sudo systemctl restart systemd-networkd

Now, the Pi is connected to both with preferred conection via Ethernet cable, as shown via ip route show:

default via 192.168.1.254 dev eth0 proto dhcp src 192.168.1.174 metric 100 
default via 192.168.1.254 dev wlan0 proto dhcp src 192.168.1.176 metric 600 
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.174 metric 100 
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.176 metric 600 
192.168.1.254 dev eth0 proto dhcp scope link src 192.168.1.174 metric 100 
192.168.1.254 dev wlan0 proto dhcp scope link src 192.168.1.176 metric 600

Now, it is possible ssh to 192.168.1.174 via Ethernet and 192.168.1.176 via WiFi, and Pi is connecting to the Internet via Ethernet 192.168.1.174.

Important: Your IPs will be different, as assigned by your own DHCP server.

8
  • 1
    This is NOT an answer. See Tour to see how this site works and How do I ask a good question? If this is intended to be part of your question EDIT the question.
    – Milliways
    Commented Apr 21 at 10:44
  • I do not understand what do you mean? The problem: Ethernet doesn't work. The answer: Enable it via systemd-networkd. What is wrong with it?
    – Michal Gow
    Commented Apr 21 at 10:48
  • 2
    @MichalGow the "answer" contains information that is missing from the question, and should have been included there instead ... the question, as it stands, is vague and cannot be answered without additional information ... you have a bad cable could also be a valid answer
    – jsotola
    Commented Apr 21 at 15:46
  • Thank you both! I hope my last edits made things clearer. I am really just trying to help here, it took me a while to figure this out with no luck on any online forum, thus I believe it really can help others.
    – Michal Gow
    Commented Apr 21 at 17:16
  • 1
    Your ACTUAL problem was probably using the RPi imager to configure your Ubuntu system. The settings it supplies are for Raspberry Pi OS and AFAIK doesn't work for Ubuntu. You should setup manually using the Ubuntu instructions. Last time I tried Ubuntu Is used Network Manager (although the server used systemd-networkd it didn't have WiFi).
    – Milliways
    Commented Apr 21 at 22:54

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.