Last active
July 14, 2023 16:58
-
-
Save braian87b/d069487f4e0eb260f73c9938a97d9bc0 to your computer and use it in GitHub Desktop.
Linux Interface Bonding on Wireless Link (OpenWrt / LEDE)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Linux Interface Bonding on Wireless Link (OpenWrt / LEDE) | |
# Attention: This was not tested yet. | |
# Important: WLAN Interfaces must be AP - STA, it does not work in ad-hoc - infraestructure mode. | |
# This "Adds" two interfaces in to one. In this sample we are using Wireless Interfaces | |
# Should be equally configured on both ends, even the hash function for the distribution of data packets | |
# Intallation of required packages: | |
opkg update | |
opkg install kmod-bonding ifenslave | |
# You will probably have configured something like this | |
# - wireless.radio0 and wireless.@wifi-iface[0].network='lan' at 2.4Ghz | |
# - wireless.radio1 and wireless.@wifi-iface[1].network='lan' at 5Ghz | |
# probably you had also WDS because your both ends wifi chipsets are from same vendor, or if not, you have properly installed RelayD, and may be also IGMPProxy too in order to simulate transparent link | |
# You could have radio0 enabled and working and radio1 disabled for now to avoid errores. | |
uci del wireless.@wifi-iface[0].network | |
uci del wireless.@wifi-iface[1].network | |
# Idk if is necessary to set on wifi-ifaces too | |
uci set wireless.@wifi-iface[0].network='wifi0' # radio0 | |
uci set wireless.@wifi-iface[1].network='wifi1' # radio1 | |
# Create new interfaces for bonding: | |
uci set network.wifi0='interface' | |
uci set network.wifi0.ifname='wlan0' # You may need to check using ifconfig and may use 'wlan0-1' if is not your first one | |
uci set network.wifi0.proto='none' | |
uci set network.wifi1='interface' | |
uci set network.wifi1.ifname='wlan1' # may need 'wlan1-1', or 'wlan1-2' if is the second or third | |
uci set network.wifi1.proto='none' | |
uci set network.bondlan='interface' | |
uci set network.bondlan.ifname='bond0' | |
uci set network.bondlan.proto='static' | |
uci set network.bondlan.ipaddr='192.168.x.x' # Complete correctly | |
uci set network.bondlan.netmask='255.255.0.0' # Complete correctly | |
uci set network.bondlan.dns='192.168.1.1' # Complete correctly | |
# Now configure the kernel module in /etc/modules.d/40-bonding | |
# Parameters: mode = balance-rr (default) | |
# try other modes: http://www.cyberciti.biz/howto/question/static/linux-ethernet-bonding-driver-howto.php | |
# enable bonding at boot, idk if could be elsewhere in better place | |
cat<<'EOF' > /etc/rc.local | |
#!/bin/sh | |
ifenslave bond0 wlan0 wlan1 | |
exit 0 | |
EOF | |
chmod +x /etc/rc.local | |
# taken from: https://wiki.opennet-initiative.de/wiki/Link_Aggregation | |
# more interesting info at: http://linux-ip.net/html/ether-bonding.html | |
# method using sysfs without ifenslave: https://backdrift.org/manage-linux-bonding-without-ifenslave-using-sysfs |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment