Score:-1

How to use two Ethernet connections at the same time (on single pc) on Ubuntu 21.04?

dk flag

I don't know how to use two Ethernet connection simultaneously on single PC. I was searching about this problem at least 4 hours, but I have no clue how to do it.

I am using Ubuntu 21.04 on this PC, this PC is connected to 2 other PCs. The first PC is used to receive files from this PC and the second one I use for remote desktop (second PC is in another room). Both PCs are connected via Ethernet cable.

However, when I turn on second connection in settings, the first one will turn off,when I turn on the first connection, the second one will turn off.

How can I use this two connections at the same time without switching between them?

In order to make this problem more understandable, please check image below:

enter image description here

Additional info:

ifconfig enp6s0; ifconfig enp4s0 (when the first connection is on):

enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether f0:2f:74:1c:15:a1  txqueuelen 1000  (Ethernet)
        RX packets 5  bytes 300 (300.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 24  bytes 3672 (3.6 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfbe00000-fbefffff  

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.2.6  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::c612:2978:2641:18e2  prefixlen 64  scopeid 0x20<link>
        ether f0:2f:74:74:61:b5  txqueuelen 1000  (Ethernet)
        RX packets 20  bytes 3285 (3.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 318  bytes 50979 (50.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

netstat -rn (when the first connection is on):

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.10.10.1      0.0.0.0         UG        0 0          0 wlp5s0
10.10.10.0      0.0.0.0         255.255.255.0   U         0 0          0 wlp5s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp4s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlp5s0
224.0.0.0       0.0.0.0         240.0.0.0       U         0 0          0 enp4s0

ifconfig enp6s0; ifconfig enp4s0 (when the second connection is on):

enp6s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 169.254.184.248  netmask 255.255.0.0  broadcast 169.254.255.255
        inet6 fe80::cc05:1420:54f5:773e  prefixlen 64  scopeid 0x20<link>
        ether f0:2f:74:1c:15:a1  txqueuelen 1000  (Ethernet)
        RX packets 5  bytes 300 (300.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58  bytes 8890 (8.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfbe00000-fbefffff  

enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether f0:2f:74:74:61:b5  txqueuelen 1000  (Ethernet)
        RX packets 20  bytes 3285 (3.2 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 323  bytes 51487 (51.4 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

netstat -rn (when the second connection is on):

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
0.0.0.0         10.10.10.1      0.0.0.0         UG        0 0          0 wlp5s0
10.10.10.0      0.0.0.0         255.255.255.0   U         0 0          0 wlp5s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 enp6s0
169.254.0.0     0.0.0.0         255.255.0.0     U         0 0          0 wlp5s0
224.0.0.0       0.0.0.0         240.0.0.0       U         0 0          0 enp6s0

Final notes:

I would appreciate something like simple guide or else.

Also, I don't want to use Internet connection for remote desktop nor file transfering.

Edit: If you need more info, please you just write comment below. Sorry for bad picture.

waltinator avatar
it flag
Through "routing". Read `man ip ip-route`. Look at `ip r`.
raj avatar
cn flag
raj
What do you mean by when you turn on the second connection, the first one turns off? Is it shown as disconnected in Network Manager? If yes, it is very strange as there should be no such dependencies between connections. You should be able to create as many connections as you need in Network Manager and turn each of them on and off independently. I have a computer (although running some older version of Ubuntu), that uses three connections without any issues.
raj avatar
cn flag
raj
Also, I would definitely use static addressing for these connections to avoid IP conflicts. I see that both your connections show IP address from network 169.254.0.0 with netmask 255.255.0.0, which means the system treats them as if they were connected to the same network. That mey be the cause of the problem. Set the IP addresses on both interfaces manually so that they definitely belong to two different networks.
Score:1
cn flag
raj

From ifconfig and netstat outputs you provided, it looks that both your connections are assigned IP addresses from the same network - 169.254.0.0 with netmask 255.255.0.0. That may be the reason why they can't be used simultaneously.

The network 169.254.0.0 is the so called autoconfiguration network. It is used when you don't specify manually any IP address in network settings, but leave the setting at default automatic assignment and there is no DHCP server in the network. In that case the connection gets a randomly selected IP address from that network. Thus, computers connected to this network can talk to each other without further configuration, but the downside is that you can have only one such network. You can't connect two autoconfiguration networks to two different network cards on one computer.

Instead of using the autoconfiguration network, you should manually configure IP addresses on all your PCs so that you have two clearly different networks.

For example, you can assign the network card enp6s0 the address 192.168.6.1 with netmask 255.255.255.0, and the network card enp4s0 the address 192.168.4.1 with netmask 255.255.255.0. They are on different networks now. Respectively, you should set the address 192.168.6.2 (with the same netmask) on the remote desktop PC, and the address 192.168.4.2 on the file transfer PC.

After you set this, your PC should be able to communicate with each of the two other PCs, but those two PCs will not be able to communicate with each other. If you need this too, you should enable IP forwarding in the kernel on your PC, so that it will act as a router and transmit packets between the two networks. To enable IP forwarding, you should uncomment the line net.ipv4.ip_forward=1 in the /etc/sysctl.conf file (or add it to the file if it isn't there), and then apply the changes with sudo sysctl -p. Also adding explicit routes to the other network on both remote PC and file transfer PC will probably be necessary.

カラス avatar
dk flag
thank you very very much! You helped me a lot. I really appreciate this answer.
FullStack Alex avatar
cn flag
Couldn't fix this issue for weeks! Thank you soooooo much!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.