Wireless and Ethernet NIC Bonding - good for laptops
jelloir
Status: Interested
Joined: 13 Jul 2009
Posts: 24
Location: Rye, Victoria, Australia
Reply Quote
I'm running Debian Sid but this should work on Lenny as well.

I have a docking station at home and sometimes un-dock it to go sit outside, in my sun room, living room etc, and still have my umbilical cord to the internet handy.

The beauty of this method is that it keeps your MAC address and IP address the same on the network and fail-over is instantaneous which has various obvious benefits such as not having to pause a torrent download and reconfigure firewall rules for your laptop for example.

Install ifenslave:

:: Code ::
apt-get install ifenslave


My /etc/network/interfaces file looks like this (replace the ssid and password for yours). I haven't configured it without WPA-PSK so cannot help you with configs other than that but it shouldn't be to hard to work out.

:: Code ::
# 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 interface
auto bond0
iface bond0 inet dhcp
  bond_mode active-backup
  bond_primary eth0
  bond_miimon 100
  bond_downdelay 200
  bond_updelay 200
  wpa-ssid wifi
  wpa-ap-scan 1
  wpa-psk wpapassword
  wpa-scan-ssid 1
  wpa-iface wlan0
  slaves eth0 wlan0


At this stage you could probably:

:: Code ::
modprobe bonding
ifdown eth0
ifdown wlan0
/etc/init.d/networking restart


But i just rebooted.

This then allows eth0 to be used when it is connected and fails over to wireless when not connected.

When I run a ping it never drops a packet when switching - very cool!

No more meddling with my networking :)
Back to top
techAdmin
Status: Site Admin
Joined: 26 Sep 2003
Posts: 4127
Location: East Coast, West Coast? I know it's one of them.
Reply Quote
Welcome to the forums, feel absolutely free to post any how-tos like this any time you want, any quality how to do anything posting is always welcome here, especially related to free software, linux, and debian specifically.
Back to top
Update for new installs from 26.04.2010
jelloir
Status: Interested
Joined: 13 Jul 2009
Posts: 24
Location: Rye, Victoria, Australia
Reply Quote
I found that after a reinstall of Debian Sid that this config no longer worked.

After a bit of googling I came across this bug report

So I Manually downloaded the Lenny ifenslave package from here and installed it.

In my case the commands looked like this. You will need to update the wget and dpkg commands with the package you end up downloading.

:: Code ::
cd /var/cache/apt/archives/
wget http://ftp.au.debian.org/debian/pool/main/i/ifenslave-2.6/ifenslave-2.6_1.1.0-10_amd64.deb
dpkg -i ifenslave-2.6_1.1.0-10_amd64.deb


And then I ran an upgrade to get the latest ifenslave package

:: Code ::
apt-get update && apt-get dist-upgrade


You could run smxi of course.

I also updated the interfaces config as follows, this may not be necessary however since it's hotplugged it no longer causes a delay at boot when bringing up the interface.

Take a look at the examples in /usr/share/doc/ifenslave-2.6/examples/

:: Code ::
# 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

#auto bond0
allow-hotplug bond0
iface bond0 inet dhcp
   bond-slaves eth0
   bond-mode active-backup
   bond-miimon 100
   bond-primary eth0

allow-hotplug wlan0
iface wlan0 inet manual
   bond-master bond0
   bond-mode active-backup
   bond-miimon 100
   bond-give-a-chance 10
   wpa-bridge bond0
   wpa-scan-ssid 1
   wpa-ap-scan 1
   #wpa-iface wlan0
   wpa-ssid wifi
   wpa-psk "wpapassword"


I still cannot get VirtualBox to bridge the bond0 interface when the wireless is active unfortunately, only works when ethernet is the active slave.

Cheers
Back to top
Display posts from previous:   

All times are GMT - 8 Hours