Channel Bonding to share the same IP for Wired & Wireless interfaces

Required: ifenslave

Create bond0, enslave lan and wifi interfaces. Tell wpa_supplicant packets enter through bond0.

In Debian this can be achieved directly through /etc/network/interfaces:

auto bond0
iface bond0 inet dhcp
	bond-primary eth1
	bond-slaves eth1 wlan1
	bond-mode 1
	bond-miimon 150

allow-bond0 wlan1
allow-hotplug wlan1
iface wlan1 inet manual
        bond-master bond0
        bond-mode 1
        bond-miimon 150
	bond-give-a-chance 10
	wpa-bridge bond0
	wpa-ssid "#MY SSID#"
	wpa-psk #MY KEY#
  • bond0 will use the master MAC
  • allow-bond0 will bring wlan1 up when bond0 gets up
  • wpa-psk can be set to a hashed value with $ wpa_passphrase <SSID> <actual passphrase>

Enable with # ifup bond0. Release a enslaved interface with # ifdown interface.

With cable connected, eth1 is used. Without, wlan1 is used.
See status with $ cat /proc/net/bonding/bond0:

Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)

Bonding Mode: fault-tolerance (active-backup)
Primary Slave: eth1
Currently Active Slave: eth1
MII Status: up
MII Polling Interval (ms): 150
Up Delay (ms): 0
Down Delay (ms): 0

Slave Interface: eth1
MII Status: up
Link Failure Count: 1
Permanent HW addr: 00:aa:bb:cc:dd:ee

Slave Interface: wlan1
MII Status: up
Link Failure Count: 0
Permanent HW addr: 00:11:22:33:44:55

FIXME Disabling wifi through rfkill (using laptop's switch or touch-sensitive button) removes it from the bond *BUT* re-enabling it won't re-add it. Re-inserting the module after enabling it does add it (e.g. switch on, run # rmmod iwlagn ; modprobe iwlagn).

  • FIXME Can module loading/unloading be hooked to an rfkill event?

FIXME Any way to use a network manager like wicd with this setup?

 
 linux/bonding.txt · Last modified: 2010/03/13 04:27 by Toni Corvera
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Driven by DokuWiki