Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
linux:bonding [2010/03/13 03:27]
Toni Corvera
linux:bonding [2012/07/28 13:40]
Toni Corvera Revamp
Line 1: Line 1:
 ====== Channel Bonding to share the same IP for Wired & Wireless interfaces ====== ====== Channel Bonding to share the same IP for Wired & Wireless interfaces ======
 +
 +Unlike when using NetworkManager or Wicd this setup allows uninterrupted switching between wired and wireless, no connections will be interrupted in the switch.
 +
 +As of this writing (Summer 2012) neither NetworkManager nor Wicd handle this kind of setup.
  
 Required: ''​ifenslave''​ Required: ''​ifenslave''​
  
-Create ''​bond0'',​ enslave lan and wifi interfaces. Tell ''​wpa_supplicant''​ packets enter through ''​bond0''​.+Create ''​bond0'',​ enslave lan and wifi interfaces. ​(Nowadays usually optional) ​Tell ''​wpa_supplicant''​ packets enter through ''​bond0''​. 
 + 
 +===== Manually ===== 
 + 
 +Up: 
 +  # modprobe -v bonding 
 +  # ifenslave bond0 wlan1 
 +  # ifconfig wlan1 up 
 +  # ifconfig bond0 up 
 +  # wpa_supplicant -B -c /​etc/​wpa_supplicant.conf -i wlan1 -b bond0  
 +  # ifenslave bond0 eth1 
 +  # ifconfig eth1 up 
 +  # echo eth1 > /​sys/​class/​net/​bond0/​bonding/​primary 
 +  # dhclient -v bond0 
 + 
 +Down: 
 +  # dhclient -v -r bond0 
 +  # ifconfig bond0 down 
 +  # ifconfig eth1 down 
 +  # ifconfig wlan1 down 
 +  # killall wpa_supplicant ​   # Is there a "​clean"​ way? 
 +  # ifenslave -d bond0 eth1 
 +  # ifenslave -d bond0 wlan1 
 +  # modprobe -v -r bonding 
 +   
 +===== Debian-style =====
  
 In Debian this can be achieved directly through ''/​etc/​network/​interfaces'':​ In Debian this can be achieved directly through ''/​etc/​network/​interfaces'':​
  
 <​code>​ <​code>​
-auto bond0+allow-hotplug bond0 # or "auto bond0"
 iface bond0 inet dhcp iface bond0 inet dhcp
  bond-primary eth1  bond-primary eth1
  bond-slaves eth1 wlan1  bond-slaves eth1 wlan1
- bond-mode 1+ bond-mode active-backup ​   # or bond-mode 1
  bond-miimon 150  bond-miimon 150
  
 allow-bond0 wlan1 allow-bond0 wlan1
-allow-hotplug wlan1+#allow-hotplug wlan1
 iface wlan1 inet manual iface wlan1 inet manual
         bond-master bond0         bond-master bond0
-        bond-mode ​1+        ​bond-primary eth1 
 +        ​bond-mode ​active-backup
         bond-miimon 150         bond-miimon 150
- bond-give-a-chance 10 +        # Usually optional: set wlan1 as active temporarily,​ tell wpa_supplicant to use bond0 
- wpa-bridge bond0 + #bond-give-a-chance 10 
- wpa-ssid "#MY SSID#"​ + #wpa-bridge bond0 
- wpa-psk #MY KEY#+        # 
 + # Single Wireless location/​access point: 
 +        #wpa-ssid "#MY SSID#"​ 
 + #wpa-psk #MY KEY# 
 +        # Multiple wireless locations 
 +        wpa-roam /​etc/​wpa_supplicant/​wpa-roam.conf ​  # And set-up wpa-roam.conf with SSIDs and Keys 
 + 
 +allow-bond0 eth1 
 +#​allow-hotplug eth1 
 +iface eth1 inet manual 
 +        bond-master bond0 
 +        bond-primary eth1 
 +        bond-miimon 150 
 +        bond-mode active-backup
 </​code>​ </​code>​
  
   * ''​bond0''​ will use the master MAC   * ''​bond0''​ will use the master MAC
-  * ''​allow-bond0''​ will bring ''​wlan1''​ up when ''​bond0''​ gets up +  * ''​allow-bond0''​ will bring ''​wlan1''​ and ''​eth1''​ up when ''​bond0''​ gets up 
-  * ''​wpa-psk''​ can be set to a hashed value with ''​$ wpa_passphrase <​SSID>​ <actual passphrase>''​+  * Bringing up one of the slaves interfaces will bring up bond0 BUT not the other slaves 
 +  * ''​wpa-psk''​ can be set to a hashed value, obtained ​with ''​$ wpa_passphrase <​SSID>​ <actual passphrase>''​
  
 Enable with ''#​ ifup bond0''​. Release a enslaved interface with ''#​ ifdown interface''​. Enable with ''#​ ifup bond0''​. Release a enslaved interface with ''#​ ifdown interface''​.
Line 61: Line 105:
   * FIXME Can module loading/​unloading be hooked to an rfkill event?   * FIXME Can module loading/​unloading be hooked to an rfkill event?
  
-FIXME Any way to use a network manager like ''​wicd''​ with this setup?+====== Possible troubles ====== 
 + 
 +I set up a new computer recently and had to use a couple tricks to get it working. Both the wireless and wired interfaces only worked when the bond was configured to their respective MAC address. My solution was to use the wireless MAC for the bond and put the wired interface in promiscuous mode. 
 + 
 +  # ifconfig bond0 hw ether 00:​11:​22:​33:​44:​55 
 +  # ifconfig eth1 promisc 
 + 
 +Debian's way:
  
 +  iface bond0 inet dhcp
 +          # ...
 +          pre-up ifconfig bond0 hw ether 00:​11:​22:​33:​44:​55
 +          pre-up ifconfig eth1 promisc
 +          post-down ifconfig eth1 -promisc
linux/bonding.txt · Last modified: 2016/04/03 18:01 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 Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki