Running multiple network connection simultaneously on Linux

Hello and I’m a very new user of Linux and I’m trying to learn about this brand new environment.

Today I ran into a problem. I have a wired broadband connection with my computer. I do also have a WiFi dongle with my PC which helps me to transfer files between my other devices. but when I connect the WiFi with other computers or phone, the connection is fine but I lose my Internet connection through the wired broadband.

I understand this as a multiple network connection error happening in Linux but I am not aware of how to solve the problem. I used to configure the metric levels of networks in windows system but I am not able to do the same on Linux. How to do that ?

I’m actually running Lubuntu 20.04 , a light-weight port of Ubuntu.

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

Maybe it is routing problem. In case two interfaces are active in the same time (and both are leaved with dynamic IP assignment) then two default routes are in collision. This command could you help to check the situation:

ip route

Search for routes starting "default" in command response. A problem is if more then one such routes (i.e. lines) are listed.
Example of unwanted state:

[email protected]:~$ ip route
default via 10.1.1.1 dev br0 proto dhcp metric 600 
default via 192.168.1.1 dev wlan0 proto dhcp metric 425 
... 
[email protected]:~$

Testing: Remove default route attached to Wi-Fi interface. Temporary way how to do it is by command:

sudo ip route del default via 192.168.1.1 dev wlan0

Correct IP address and interface name must be copied from your previous "ip route" command output.

Now re-check routes by "ip route". Only one route should remain in list. Then check the internet connection. If all is OK, you have found solution. Use one of these possibilities:

  1. Modify Wi-Fi interface setting in IPv4 section (e.g. using GUI system setting). Change Wi-Fi IP address assignment from Automatic to Manual, set own IP address, but leave default route empty!
  2. Create small script containing "sudo route del …" command and run it in case you use both interfaces. The script must be started AFTER Wi-Fi interface is activated.

In case you will lost connection to your other devices connected via Wi-Fi, you should add or modify static routes. I will try to help you to solve this secondary problem, but more details and command outputs are needed.

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply