How do I make use of both the internet connections in my computer?

I have two internet connections: one using the Ethernet and another using the WiFi.

❯ ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: ens32: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether <mac addr> brd ff:ff:ff:ff:ff:ff
    altname enp2s0
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether <mac addr> brd ff:ff:ff:ff:ff:ff

I am wondering if I can use both of them in the following ways:

Choose a default connection:

Can I specify which of the connections will the default when I start my computer?

Use another connection as fail safe:

Currently if the default Ethernet connection fails (no internet from ISP) then thats it. My system doesn’t try to use the perfectly working other connection, I have to manually disconnect the current connection.

Is there a way to simply switch to another connection if the current one fails?

Use both connections for maximum speed:

Looks like hardware such as routers with dual WAN is needed but there is also freemium software like Speedify exists. I wonder if there is a free program that does it? Or maybe just some network configuration on my system will do the trick?

The question is what exactly do you want to accomplish ?
Fail over with 2 internet connections?
Assuming that you have 2 ISP, those connections can be configured in a fail over takeover scenario by your router.
Improved speed?
In networking the speed is not magically summed up, more often than none, the speed will fall back to the lowest denominator speed.
Ex. You have 2,5G speed, 2,5Gb NIC, but your switch is 1Gb, so being this your common denominator, your LAN speed will be 1Gb.

Two or more connections can be bridged, it sums up your connections. Yes it add more speed to that bridged connection, but not so much.

What router you have? Other network gear?

Exactly. If the connection I am using fails I want the system to automatically use the other connection for internet connectivity.

But could it be the OS instead of the router doing the switching?

In networking the speed is not magically summed up, more often than none, the speed will fall back to the lowest denominator speed.

I know that the speed doesn’t add up. Eg: Connection A can do 10 Mbps and B can do 20 Mbps. It will never be 30 Mbps but two downloads can have 10 Mbps and 20 Mbps each.

Also I can’t invest in hardware right now. I think the routers I have, Asus RT AC53 and another no name ONT Modem are not capable of such feats. So I am wondering if there is a software solution.

OpenWRT can load-balance your Internet connection across two or more ISP.

In the past i used to setup my network with openWRT running on my router for load balancing/failover between two ISP’s.

You could check to see if your router is supported or not.

or maybe you are looking for something like this?

1 Like

What you describe as requirements, sound like you are talking about bonding.

I haven’t done it myself, or know of a fully automated way/utility.
You may do it the Arch way and give feedback, so we learn more. :wink:

2 Likes

Have you tried the speedify package from the AUR? I have both fast WiFi and very fast Ethernet connection. But WiFi is no where near my Ethernet connection speed. I can have both connected at the same time but when i run a speed test it usually is using Ethernet. I think in terms of speed if i were to try speedify it may help speed up my WiFi downloads but I’m not sure it would have a negative affect on my Ethernt since WiFi is slower? :thinking:

Maybe i try this it and see.

Edit: Just tried the package and i don’t find any difference.

Edit2: Is fast enough anyway on Ethernet.
Screenshot_20221004_140835

1 Like

Yes. Bonding is the answer.

Network interface bonding is called by many names: Port Trunking, Channel Bonding, Link Aggregation, NIC teaming, and others. It combines or aggregates multiple network connections into a single channel bonding interface. This allows two or more network interfaces to act as one, to increase throughput and to provide redundancy or failover.

The Linux kernel comes with the bonding driver for aggregating multiple physical network interfaces into a single logical interface (for example, aggregating eth0 and eth1 into bond0). For each bonded interface you can define the mode and the link monitoring options. There are seven different mode options, each providing specific load balancing and fault tolerance characteristics.


NetworkManager provides a nice GUI to do it. You never have to drop to a terminal. But I ran into a problem. My WiFi won’t work when I enabled bonding. So I tried systemd-networkd but I ran into the same problem.

So it’s not NetworkManager but the mode I was choosing. "Adaptive Load Balancing " seemed interesting and I selected it. But my WiFi (WiFi through USB) won’t support it.

In my defense the error messages from NetworkManager are cryptic if not downright apathetic. The error messages were “Failed due to no reason” and “unknown error” (or something like that). It is when I used systemd-networkd I was given the more informative error-- “Mode is not supported by wifi” (or something like that).

I tried all the modes and to my dismay only active-backup mode is supported. For every other mode either the eth or the wifi failed to support it. So no load balancing for this old boy.

So currently I am using systemd-networkd to bond my eth and wifi connection in active-backup mode. It helps in fault tolerance.

Details:

❯ networkctl
IDX LINK  TYPE     OPERATIONAL SETUP     
  1 lo    loopback carrier     unmanaged
  2 ens32 ether    enslaved    configured
  3 wlan0 wlan     enslaved    configured
  4 bond1 bond     routable    configured

4 links listed.
$ cat /proc/net/bonding/bond1
Ethernet Channel Bonding Driver: v5.19.13-arch1-1

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: ens32 (primary_reselect always)
Currently Active Slave: ens32
MII Status: up
MII Polling Interval (ms): 1000
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: wlan0
MII Status: up
Speed: Unknown
Duplex: Unknown
Link Failure Count: 0
Permanent HW addr: ff:ff:ff:ff:ff:ff
Slave queue ID: 0

Slave Interface: ens32
MII Status: up
Speed: 100 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: ff:ff:ff:ff:ff:ff
Slave queue ID: 0

Blog posts that helped me setup NIC bonding:


Is my switching to systemd-networkd from good old NetworkManager justified? No but I don’t care. I already use systemd-resolved so may be they will gel well together. I will only switch back if I miss having a GUI to manage networks. (hopefully I won’t miss a GUI)

2 Likes

But Speedify seems to be freemium and I don’t have any spare monies! Otherwise it seems such and easy an uncomplicated solution.

1 Like

Net-ISP-Balance seems very interesting. Unlike NIC bonding which happens in the kernel space this seems to be happening in the userspace (I only skimmed the docs). Maybe I will have better luck with this regarding load balancing. I will try this when I get some time.

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.