Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Direct Question: My evga classified motherboard has two ethernet ports. I want to use them simultaneously to improve the speed of a remote connection. (Yay for programming remotely). How do I do this? At present /etc/network/interfaces:

auto lo eth0 eth1

iface lo inet loopback

iface eth0 inet static
address 192.168.1.202
netmask 255.255.255.0
gateway 192.168.1.2

ifrace eth1 inet static
address 192.168.1.201
netmask 255.255.255.0

What should I change? Is there a package I need to install to bond the two channels.

Background: I do a lot of remote computing both from home to office and office to home. But (to take my ISP out of the equation), let's frame the question as if I'm really just interested in maximizing the file transfer rate between two computers on the same (local) network. Both boxes have dual ethernet motherboards. Using a simple Linksys WRT54GS as a 5 port switch (ignore wireless and isp) -- how do I maximize the transfer rates between the computers?

Please Note: I'm not interested in load balancing -- Correct me if I'm wrong, but I want to bond the two channels together so that the box appears as if it has one connection that's twice as fast.

share|improve this question
1  
I would think going through a switch would limit any benefit you would get from using 2 Ethernet cables in parallel. Maybe if you used two switches it might maybe make sense somehow. I think the only possible benefit you will get is with a direct connection. –  WalterJ89 Mar 27 '11 at 4:55
1  
Usually in a home - office connection, the bottleneck is the ISP, so doing link aggregation on the two ends of the link doesn't improve much. –  bitwelder Mar 27 '11 at 15:29
add comment

7 Answers

up vote 1 down vote accepted

Its important to note that in order to utilize NIC teaming functionality the switch you're connected through must support teaming aka LACP. You can find a switch like that through a search on NewEgg.com etc.

Once you have that here is a simple guide from the wiki: https://help.ubuntu.com/community/UbuntuBonding

Good luck!

share|improve this answer
    
Yep, good luck, because while this will work, it won't result in a speed increase. –  Scaine Aug 26 '12 at 7:37
add comment

It's very unlikely that bonding your interfaces will result in a speed increase. Typically, even if you bond the interfaces successfully AND configure the switch to support the etherchannel), then you will still find that only one interface in the bond is used for each pair of source/destination TCP/UDP session.

So if you copy a 10Gb file from one server, then kick off another 10Gb copy to that server, assuming that you also have session based bonding, you'll see both cards maxed out. But crucially, the first copy will only consume ONE network card, not both.

This is certainly the case with Cisco's etherchannel. In fact, Cisco's etherchannel isn't even session based, it's source/destination based, so in my example above, you wouldn't even get a speed increase - your second copy would have to be to a completely different server before you saw both cards used. Perhaps you have a better switch that allows for the port channel to utilise both cards simultaneously in one TCP/UDP session but it would require some pretty funky arp/MAC manipulation and I have no idea if the bonding module in linux supports that.

As for you, you're using a bog-standard home router, so switch-side support is out of the question here, meaning that your options are further limited (see the first article lined to below, where you will note that you now cannot use the best mode for link aggregation, mode 4).

If you're determined to go ahead with this, I found this five year old article which still seems relevant. Additionally, this three year old article covers the same ground.

Hope it helps.

share|improve this answer
add comment

I would think going through a switch would limit any benefit you would get from using 2 Ethernet cables in parallel. Unless the switch is faster than your two NICs combined, in which case then you might see a speed increase.

Load Balancing program is what you are looking for. You don't have to "load balance" if you don't want to, but it is the easiest way to merge the connections I know of. The Idea is not too complicated

Virtual NIC - > Load Balancing Program -> NIC 1 + 2

This answer has what you are looking for I believe: Network load-balancing with Network Manager

I'm not sure on the specifics but I'm sure that is the general idea.

Unless the NIC cards are substantially less powerful than your router/switch the only benefit you will probably get is with a direct connection between the two computers, Or a parallel connection the whole way. But theory and practice don't always work out.

The only way I can think of to test if the NIC is the bottleneck in your system is to do a speed test between each computer using all 4 NICs. I can give you the general Idea on how to do this but the Ubuntu specific stuff I'll need a hand with.

  1. Set each NIC to have its own IP address like 192.168.0.1 + 192.168.0.2 for computer 1 and *.3 + *.4 for computer 2
  2. The only speed test for local networks I've seen is just transfer time on a bit file. I'm not sure if there is a better method, I've never seen one.

    3 Set routes manually so *.1 is the interface to get to *.3 and *.2 get to *.4.
    PC1 192.168.0.1 <--> 192.168.0.3 PC2 192.168.0.2 <--> 192.168.0.4

I've never used ip tables so here is something I found as an example.

[root]# ip route add xx.xxx.239.120 via xx.xxx.239.120 dev eth0 table 4
[root]# ip route add table 4 default via xx.xxx.239.120 
[root]# iptables -t mangle -A PREROUTING -p tcp --dport 80 -s xx.xxx.239.120 -j MARK --set-mark 4 
[root]# iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source xx.xxx.239.120 [root]# ip rule add fwmark 4 table 4
  1. another option is to find a way for ssh (or terminal) client to connect via certain interfaces. I'm not sure how thats done yet for the client side.

If IP tables is set up correctly you should be able to send 2 files from PC 1 to both interfaces on PC 2 and each file will take a different route. If the transfer with the two connections is faster than just one.. (hopefully twice as fast) then you might have something.

share|improve this answer
add comment

There is a library called firehose which can transfer data over multiple network devices simultanteously. It doesn't give you a single virtual network device though, and it doesn't support TCP. It's designed for high bandwidth video streaming for video editors. Could be interesting to you though:

http://heroinewarrior.com/firehose.php

share|improve this answer
add comment

I was faced similar situation and found this:

http://ubuntulinuxhelp.com/how-to-use-the-second-network-port-on-your-computer/

But its somewhat old, Hope it helps.

share|improve this answer
add comment

Using Port Bonding and Round-Robin policy on both devices connected through an un-managed switch will in fact nearly double your transfer rate. Round-Robin policy defaults to load balancing over multiple devices and falls back to single-port if one device fails.

However, I believe your WRT54GS is a router and therefore managed so you won't get the full benefit from the bonding.

Assuming you were to use a cheap 8-port true switch that supported RR policy and then connect it to the router, you would get increased transfer speeds between the two devices using bonding through the switch and normal transfer speeds to the internet and rest of the network.

You should also increase your read/write buffers, txqeueuelen and your netcore and tcp memory.

share|improve this answer
add comment

I don't think you said whether or not you were using a Gigabit NIC, I am guessing you are since you have 2 NICs and therefore probably a gaming motherboard.

Since that is the case, if you are trying to get 2x100 base then you are better off buying a cheap 4-8 port Gigabit switch and plugging it into your Internet router. Then you can plug all the computers that run Ethernet into that switch and still have working wifi and Internet on all your computers.

I do that now because I bought a Netgear WNDR3400 and put DD-WRT on it so that I could have a few nice options including a very up to date NAS server built in.

The only problem was that the router was 100 base on the Ethernet ports. So for $40 I bought a 5 port Gigabit switch plugged it into my router then plugged all my computers into the Gigabit switch and plugged my gaming consoles into the router.

Everything works great and I can transfer files between the computers at lightning speeds.

Well good luck!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.