Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Linux network bonding... use case?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Thu Sep 29, 2022 7:26 am    Post subject: Linux network bonding... use case? Reply with quote

I wonder if this works:

I have an old laptop PC with built-in 10/100 Ethernet, no USB3, no PCMCIA, and 802.11n that seems to top out at 7MB/sec on a good day.
I have a USB2 10/100 Ethernet dongle.

Can I bond the two Ethernet devices together and plug both network connectors into two ports of a Gbit switch, and have them communicate to a machine with a native single Gbit Ethernet at 20MB/sec with no software hacks on that machine? I suspect a 10/100 switch with a GbitEthernet uplink to a Gbit machine should work similarly instead of wasting two Gbit ports?

If that works, what happens if the USB disconnects? One of the Ethernets disconnects?

Could I also bond the 802.11n and get all three to speed data along?

Other than a USB2 HDD, I wonder if this is a legit way to get data faster in/out of this machine... Anyone tried this and if it works, had good scalable results?
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Thu Sep 29, 2022 9:01 am    Post subject: Reply with quote

Hi,

in theory, yes, you can bond them, but...

1. if you want a bit more "bandwdith" you need a managed switch, where you can config either lacp (802.3ad) or something similiar
2. if you use something like round robin, there is a chance, that you can use it without a managed switch, but it will not really improve throughput.

mostly you wont get more then the typical 10-12mb/s throughput, even with lacp, because "one bit" cannot be devided at last ;-)

if the usb disconnects and you have something like active-standby config, it will continue to run your network after maybe 2-5 loss packets. but this shouldn't be a problem at all.

greeting, Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Thu Sep 29, 2022 3:04 pm    Post subject: Reply with quote

At the physical layer, how does the "other" computer connected to the switch chose which bonded interface to send to...this seems very messed up IMHO, seems to require the other machine to know the topology of the machine with the bonded interface.

I think I have two manageable switches that I'm either using or in storage, but running them unmanaged at the moment. I'm not even sure they can do link aggregation (one is a Dell PC2708), that would make more sense than the so-called bonding.

I was hoping for much higher than 10-12MB/sec throughput, I already get 10-11MB/sec through the 10/100Mb onboard Ethernet by itself. Would be nice to get higher speeds through USB2 (480Mb/sec theoretical, have seen 30MB/sec to USB HDDs) and if I could aggregate 150Mb 802.11n too (seen 7MB/sec), that would be great.

My "pie in the sky" would be near 50MB/sec, hopefully using commodity hardware.
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3131

PostPosted: Thu Sep 29, 2022 9:59 pm    Post subject: Reply with quote

Quote:
At the physical layer, how does the "other" computer connected to the switch chose which bonded interface to send to...this seems very messed up IMHO, seems to require the other machine to know the topology of the machine with the bonded interface.
It depends.

If you use LACP for example, your machine and the switch will send packets using each _available_ interface in a fashion similar to round-robin.
Errors or disconnecting a wire will flag the interface as faulty and remove it from rotation, and the remaining interfaces will pick up the slack.
This gives you link aggregation and fault resistance, but requires a static configuration on your machine and the switch you're connected to.
AFAIR bonding driver does not support this mode, but teaming driver does.

If you use bonding driver in mode 6 (I think it was mode 6), every enslaved interface will keep its MAC address. When your computer receives an ARP query, it will hash source and destination IP, use the result to select an interface, and send the ARP response with MAC address of the selected physical NIC.
Multiple peers will be pointed to different interfaces, so your total bandwidth is as high as all interfaces combined, but none of your peers will ever be able to take advantage of link aggregation. You retain the fault resistance though, since breaking one of the wires will still kick this NIC out of the valid pool and remap that connection to another MAC.

There are other modes too, and some hacks are possible (like connecting 2 interfaces to 2 separate switches), some modes are very simple and will let the network decide to flood one interface will everything (retaining fault resistance, but not speed increase), other require the peer to have a matching configuration.
Basically, a smart switch with matching configuration and mode 6 are really the only 2 options you should consider unless you have some very particular requirements (and if you did, you'd already know why exactly those 2 modes suck for you)

Quote:
and if I could aggregate 150Mb 802.11n too
Wifi is a bit special; you can certainly try to enslave it, but no guarantees it will just take it.
There is nothing inherently wrong about it though.
Back to top
View user's profile Send private message
eccerr0r
Watchman
Watchman


Joined: 01 Jul 2004
Posts: 9677
Location: almost Mile High in the USA

PostPosted: Fri Sep 30, 2022 12:23 am    Post subject: Reply with quote

So what I'm hearing is that there's nothing really special about bonding and it only helps availability and sharing of the resource to multiple clients versus to one specific client. Sort of what I thought initially, but got a little giddy when I thought I read that it could share to one target...which would be what I need.

I don't think my switches support link aggregation so that's probably out of the question.

I may still have to implement this on my server to squeeze a bit more out of the network interfaces to multiple clients...
_________________
Intel Core i7 2700K/Radeon R7 250/24GB DDR3/256GB SSD
What am I supposed watching?
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Mon Oct 17, 2022 9:13 pm    Post subject: Reply with quote

Recommended reading: /usr/src/linux/Documentation/networking/bonding.rst.

A very neat use case along those lines is the lagg device on FreeBSD, e.g https://docs.freebsd.org/en/books/handbook/advanced-networking/#network-aggregation, example 3. It shows a config for failover between a laptop's wired and wireless interface for seamless networking and retaining the same IP, no matter how you're connected. It's very simple and IMHO much easier than https://matoski.com/article/wifi-ethernet-autoswitch/.
Back to top
View user's profile Send private message
Spanik
l33t
l33t


Joined: 12 Dec 2003
Posts: 942
Location: Belgium

PostPosted: Fri Oct 21, 2022 8:25 am    Post subject: Reply with quote

I have bonded the 2 ethernet interfaces in the desktop and set them to LACP. Likewise the NAS has 2 interfaces bonded and set to LACP. The switch in between has for the desktop and NAS a couple of bonded ports with LACP. Each time this are "identical" ports, same type and brand of chips. The idea was to have good bandwidth between NAS and desktop.

What I see is that one port is almost exclusively used for transmitting, the other for receiving and I get about 300Mbps continuously when transfering files. Files are about 30-100MB each, 300 to 1000 files at a time with rsync.

I do have a second switch that I planned to install downstairs and link both switches in the same way. But when I see the disappointing result (not even half of what a single interface can do in theory) I'm having second thoughts about that. Now I don't know where the bottleneck is. Could be that I cannot get the data fast enough from the HD in the desktop (doubt that with 6Gb sata), that the switch cannot do better (there isn't much connected to it that really moves much data) or is it the NAS that cannot accept data faster (QNAP running TrueNAS).
_________________
Expert in non-working solutions
Back to top
View user's profile Send private message
Princess Nell
l33t
l33t


Joined: 15 Apr 2005
Posts: 916

PostPosted: Fri Oct 21, 2022 8:42 pm    Post subject: Reply with quote

Look at xmit_hash_policy.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum