Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Linux network /etc/network/interfaces file to bond eth0 and wlan0 into one virtual interface bond0
# Regardless of how our topology looks, we'll need the local interface
auto lo
iface lo inet loopback
# Configuration basics taken from:
# http://www.kernel.org/doc/Documentation/networking/bonding.txt
# Define the bonding master, which is ideally our only interface to the outside world
# - define slaves as none initially, this helps with booting faster
# - the primary line makes most sense here, but is not enough
# - set the interface check interval to 100ms
# - we activate 1 interface at a time for now, if one fails, the other takes over
auto bond0
iface bond0 inet dhcp
bond-slaves none
bond-mode active-backup
bond-primary eth0
bond-miimon 100
# Slave: wired ethernet connection port, typically our office connection
# - critical that the type is set to 'manual'
# - typically wired is the fasted connection, so make this the primary
# - the primary line seems redundant but is needed here
auto eth0
iface eth0 inet manual
bond-master bond0
bond-primary eth0
# Slave: the wireless connection interface
# - critical that the type is set to 'manual'
# - interface roams under control of wpa_supplicant
# - the primary line seems redundant but is needed here
# -
# - tell the interface that packets come in over bond0 instead of wlan0
# - the wpa conf file contains network definitions and other settings.
auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
bond-master bond0
bond-give-a-chance 10
bond-primary eth0
wpa-bridge bond0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
# TODO: configure the WAN interface as slave
# TODO: configure the Bluetooth interface as slave
# TODO: why use active-backup when we could combine interfaces and gain some speed if we can.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment