0

I have a Raspberry Pi 4 running Ubuntu 22.04 server edition, it can connect to the local network via either wired eithernet or Wi-Fi connections. Currently, it defaults to the Wi-Fi connection, but I want it to default to the wired connection.

Running $ ip a give the following

$ 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
    inet6 ::1/128 scope host 
       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:e1:39:d1 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.253/24 brd 192.168.1.255 scope global dynamic eth0
       valid_lft 64035sec preferred_lft 64035sec
    inet6 fe80::dea6:32ff:fee1:39d1/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether dc:a6:32:e1:39:d4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 metric 600 brd 192.168.1.255 scope global dynamic wlan0
       valid_lft 67889sec preferred_lft 67889sec
    inet6 fe80::dea6:32ff:fee1:39d4/64 scope link 
       valid_lft forever preferred_lft forever

I have no access to the network settings via a GUI (using a remote desktop) as all the settings in the Network Connections consol are greyed out. So can only really work with the command line over ssh.

1 Answers1

0

When the interface (eth0 or wlan0) comes UP, it broadcasts a DHCP "Who Am I" message to the local network. The DHCP server responds with a message containing [IP Address, the "gateway" (where to send non-local packets) and DNS Server IP addresses, the MTU, the netmask, and more].

This data is used to configure your system's networking.

When your system boots, eth0 startup is quick (it's just a wire), and networking is set up for eth0 (the way you want).

wlan0 startup is slower, but eventually starts up, and sets up wlan0 networking, the undesired configuration.

One solution is to remove the "Auto" flag from the wlan0 interface, and start wlan0 manually, at need.

Another possible solution is my net-o-matic bash script:

https://github.com/waltinator/net-o-matic It watches the connection, and when the connection drops, does a user-specified thing to try to reconnect.

waltinator
  • 36,399
  • "One solution is to remove the "Auto" flag from the wlan0 interface, and start wlan0 manually, at need." How do I do that? – Kim Harding May 22 '23 at 19:05
  • 1. "System Settings"->Network->wlan0. 2. See the example that comes with net-o matic. __3.__Comments are designed for US to ask YOU questions about your Question. You should [Edit] your question to add information. By updating your Question, and using the formatting buttons, you make all the information available to new readers. People shouldn't have to read a long series of comments to get the whole story. AskUbuntu is a Question and Answer site, not a conversation site. If you have an update, [edit] your Question. If you have a new question, see [Ask]. – waltinator May 22 '23 at 19:33