I want to use WiFi port of my server as redundant link for copper connection to my home DSL router. My router if SAGEM 2704 with very limited functionality. So practically the only possibility is to configure something on the server. Is it possible to use WiFi for redundancy. If so, what I have to implement on my server?
1 Answers
You're looking for bonding. This driver is intended for (surprise!) bonding individual links to one logical link. Several modes are supported, one of them is fail-over mode (you have one primary link, in your case wired ethernet, and several fail-over links, which take over when the primary link fails).
What you'll need is CONFIG_BONDING enabled in the kernel. With this enabled (and the appropriate module bonding loaded if built as module) can do the following:
Create a bonding interface:
# echo +bond0 > /sys/class/net/bonding_mastersSet
active-backupmode (fail-over):# echo active-backup > /sys/class/net/bond0/bonding/modeAdd interfaces to the bonding device:
# echo +eth0 > /sys/class/net/bond0/bonding/slaves # echo +wlan0 > /sys/class/net/bond0/bonding/slavesMake
eth0the primary interface:# echo eth0 > /sys/class/net/bond0/bonding/masterEnable link monitoring (periodically test for link availability every second):
# echo 1000 > /sys/class/net/bond0/bonding/miimonUse
bond0as network interface (eth0andwlan0don't need any further configuration: IP addresses et al are configured onbond0now).
- 10,112
- 1
- 32
- 38
-
OK. THX. At this moment (because of many reasons) I have two IP addressees assigned to eth0. So at this moment I cand assign two IP addresses to interface bond0 and change appropriate entries in iptables definitions from eth0 to bond0. I am right? – mackowiakp Apr 17 '14 at 16:58
-
I can modprobe bonding, but how can I check CONFIG_BONDING option in my kernel? Or how to set it enable? – mackowiakp Apr 17 '14 at 16:59
-
Most distributions have the option enabled that let's you read the (running) kernel's config from `/proc/config.gz`: `zgrep CONFIG_BONDING /proc/config.gz`. You can assign multiple addresses to network interfaces, have a look at `man 8 ip-address` (using `ip` tool from `iproute2` is the more recent and more powerful approach of configuring network interfaces than using `ifconfig`). – Andreas Wiese Apr 17 '14 at 18:04
-
zgrep CONFIG_BONDING /proc/config.gz command shows CONFIG_BONDING=m . Does it mean "bonding enable"? – mackowiakp Apr 18 '14 at 06:07
-
This means, the bonding driver is built as a module. Try `modprobe bonding`. – Andreas Wiese Apr 18 '14 at 10:05
-
Ok. modprobe bonding works and module is loaded via modprobe.preload. THX for help! – mackowiakp Apr 18 '14 at 17:00
-
1BTW: No idea if you want to update this answer, but if you do then (a) consider also teaming as an alternative to the bonding driver; (b) NetworkManager can set up both bonding and teaming. (Generalizing a little is OK—we're using this question as the target of duplicates, e.g., if someone needs to set up bonding on his/her laptop). – derobert Sep 05 '17 at 20:57