Bonding Ethernet and Wireless interfaces for extra Speed & Reliability.

I recently moved home and now my home server needs to be situated in a different room than my router.  I tried running the server on wifi only but it was a bit frustrating despite using dual band router and dual band USB interface.  Speed is still nothing like gigabit ethernet and sometimes there were problems remounting nfs shares on resuming my desktop from sleep.  Next I tried a TP-Link Gigabit Powerline kit.  This is better but still very noticably slower than regular wired gigabit ethernet.  My next idea was to bond the Powerline ethernet and wireless ‘N’ interfaces in order to aggregate the interfaces for a speed boost and for fail over reliability.  This works!

Here’s the key: ignore almost all the examples and howtos you found on Google.  There are some very confusing and complicated and downright wrong explanations and examples out there.  I also suspect that some people just prefer to do it the hard way.

Anyway, here’s my set up and what worked for me:

My router gives me 4 Gigabit ethernet ports and dual band wifi.  The wifi is encrypted with WPA2 PSK (CCMP).  I have static addresses for my desktop and printer.  Other stuff gets an address via DHCP.

One Gigabit port is used to connect with a Powerline adapter.  Another port goes to my desktop and another to my printer/scanner.

My server runs Debian Jessie 8.2.  It is on another floor and is connected by ethernet to another Powerline adapter which is paired to the one at the router.  The server also has a USB dual band wireless adapter.  The wireless driver is in the standard Debian kernel and the firmware was available from a package in Debian’s non-free repo.

So, to get the network interfaces bonded I neeeded to install ifenslave and then reboot or restart networking service.

# apt-get install ifenslave && reboot

Next edit /etc/network/interfaces so it looks like this:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

## BONDING RR ###
allow-hotplug eth0
auto eth0
iface eth0 inet manual
bond-master bond0

allow-hotplug wlan1
auto wlan1
iface wlan1 inet manual
bond-master bond0
wpa-ssid “MY_SSID”
wpa-psk “MY_SECRET_KEY”
wireless-channel “36”

 
auto bond0
iface bond0 inet static
address 192.168.1.3
netmask 255.255.255.0
gateway 192.168.1.1
bond-mode 0
bond-miimon 100

 

Naturally you need to specify your own SSID and key and of course your own preferred IP address, netmask and gateway.  You might not need to specify the wireless channel.  I found it useful to do so in order to avoid using the more congested 2.4GHz band.

I specified a static address on the server but did not reserve an address on the router, which does the sane thing and allocates the address requested  by the server.  This works perfectly for me but may not work on a busier LAN.

I reboot.  It works!

Here’s the proof:

# ifconfig
bond0 Link encap:Ethernet HWaddr 00:1d:72:a0:dc:ed
inet addr:192.168.1.3 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21d:72ff:fea0:dced/64 Scope:Link
UP BROADCAST RUNNING MASTER MULTICAST MTU:1500 Metric:1
RX packets:2436064 errors:0 dropped:2995 overruns:0 frame:0
TX packets:2438371 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1741347675 (1.6 GiB) TX bytes:4336225638 (4.0 GiB)

eth0 Link encap:Ethernet HWaddr 00:1d:72:a0:dc:ed
inet6 addr: fe80::21d:72ff:fea0:dced/64 Scope:Link
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1213626 errors:0 dropped:0 overruns:0 frame:0
TX packets:582146 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:746352277 (711.7 MiB) TX bytes:2081911527 (1.9 GiB)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:528 errors:0 dropped:0 overruns:0 frame:0
TX packets:528 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:67546 (65.9 KiB) TX bytes:67546 (65.9 KiB)

wlan1 Link encap:Ethernet HWaddr 00:1d:72:a0:dc:ed
UP BROADCAST RUNNING SLAVE MULTICAST MTU:1500 Metric:1
RX packets:1222485 errors:0 dropped:0 overruns:0 frame:0
TX packets:1856282 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:994998751 (948.9 MiB) TX bytes:2254380081 (2.0 GiB)

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: