Last active
January 7, 2024 19:31
-
-
Save braian87b/8a524a8ad74a36407a8f481e9d16a5c9 to your computer and use it in GitHub Desktop.
How to setup Wireless Links to avoid Wired backbone using WDS on Atheros for OpenWRT / LEDE
This file contains 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
# ==================================================================================== | |
# Steps for Main Router (must have connected internet on WAN port) | |
# ==================================================================================== | |
# Set your network IP address configuration default is 192.168.1.0/24 | |
uci set network.lan.ipaddr='192.168.1.1' | |
# Recommended, to identify on network and when logged on | |
uci set system.@system[0].hostname='MainRouter' | |
uci set network.lan.hostname="`uci get system.@system[0].hostname`" | |
uci set wireless.radio0.htmode='HT40' # use a wider channel if capable | |
uci set wireless.radio0.channel='auto' # autoselect channel | |
uci set wireless.radio0.disabled='0' # enable radio | |
uci set wireless.@wifi-iface[0].network='lan' | |
uci set wireless.@wifi-iface[0].device='radio0' | |
uci set wireless.@wifi-iface[0].mode='ap' | |
uci set wireless.@wifi-iface[0].encryption='psk2+aes' | |
uci set wireless.@wifi-iface[0].ssid='Link1' | |
# md5('WiFi-Link') = 'b2d436a33a207c8b246d7c6f7f7af760' | |
uci set wireless.@wifi-iface[0].key="`echo -n 'WiFi-Link' | md5sum | cut -d ' ' -f 1`" | |
# Important for WiFi Link: | |
uci set wireless.@wifi-iface[0].wds='1' | |
#uci set wireless.@wifi-iface[-1].hidden='1' # Pending to try, will keep you updated | |
# Second WiFi interface for conventional use (will be the same on each AP and devices will roaming between them) | |
uci add wireless wifi-iface | |
uci set wireless.@wifi-iface[-1].network='lan' | |
uci set wireless.@wifi-iface[-1].device='radio0' | |
uci set wireless.@wifi-iface[-1].mode='ap' | |
uci set wireless.@wifi-iface[-1].encryption='psk-mixed+tkip+aes' | |
uci set wireless.@wifi-iface[-1].ssid='WiFi-Network' | |
uci set wireless.@wifi-iface[-1].key='password' | |
# Third WiFi interface, for visits (optional) | |
uci add wireless wifi-iface | |
uci set wireless.@wifi-iface[-1].network='lan' | |
uci set wireless.@wifi-iface[-1].device='radio0' | |
uci set wireless.@wifi-iface[-1].mode='ap' | |
uci set wireless.@wifi-iface[-1].encryption='psk-mixed+tkip+aes' | |
uci set wireless.@wifi-iface[-1].ssid='WiFi-Network-Guests' | |
uci set wireless.@wifi-iface[-1].key='askforpassword' | |
# you could disable it and enable it when is needed | |
uci set wireless.@wifi-iface[-1].disabled='1' | |
# ======================================================== | |
# Optional, Disable IPv6 | |
# ======================================================== | |
uci del network.lan.ip6assign | |
uci set network.lan.delegate='0' | |
uci del dhcp.lan.dhcpv6 | |
uci del dhcp.lan.ra | |
uci del dhcp.odhcpd | |
/etc/init.d/odhcpd disable | |
/etc/init.d/odhcpd stop | |
# ======================================================== | |
# Remove WAN6 (IPv6 on WAN) | |
# ======================================================== | |
uci del network.wan6 | |
uci del_list firewall.@zone[1].network='wan6' | |
# ======================================================== | |
# Commit changes, flush, and reboot | |
# ======================================================== | |
uci commit | |
sync | |
#/etc/init.d/network restart | |
reboot | |
# ==================================================================================== | |
# Steps for Wireless each Link | |
# ==================================================================================== | |
uci set network.lan.ipaddr='192.168.1.2' | |
uci set system.@system[0].hostname='Repeater1' | |
uci set network.lan.hostname="`uci get system.@system[0].hostname`" | |
uci set wireless.radio0.htmode='HT40' | |
uci set wireless.radio0.channel='auto' | |
uci set wireless.radio0.disabled='0' | |
# First WiFi interface, it connects to MainRouter | |
uci set wireless.@wifi-iface[0].network='lan' | |
uci set wireless.@wifi-iface[0].device='radio0' | |
uci set wireless.@wifi-iface[0].mode='sta' | |
uci set wireless.@wifi-iface[0].encryption='psk2' | |
uci set wireless.@wifi-iface[0].ssid='Link1' | |
uci set wireless.@wifi-iface[0].key="`echo -n 'WiFi-Link' | md5sum | cut -d ' ' -f 1`" | |
uci set wireless.@wifi-iface[0].wds='1' | |
# Second WiFi interface | |
uci add wireless wifi-iface | |
uci set wireless.@wifi-iface[-1].network='lan' | |
uci set wireless.@wifi-iface[-1].device='radio0' | |
uci set wireless.@wifi-iface[-1].mode='ap' | |
uci set wireless.@wifi-iface[-1].encryption='psk-mixed+tkip+aes' | |
uci set wireless.@wifi-iface[-1].ssid='WiFi-Network' | |
uci set wireless.@wifi-iface[-1].key='password' | |
# Another WiFi Link | |
uci add wireless wifi-iface | |
uci set wireless.@wifi-iface[-1].network='lan' | |
uci set wireless.@wifi-iface[-1].device='radio0' | |
uci set wireless.@wifi-iface[-1].mode='ap' | |
uci set wireless.@wifi-iface[-1].encryption='psk2+aes' | |
uci set wireless.@wifi-iface[-1].ssid='Link2' | |
uci set wireless.@wifi-iface[-1].key="`echo -n 'WiFi-Link' | md5sum | cut -d ' ' -f 1`" | |
uci set wireless.@wifi-iface[-1].wds='1' | |
# To allow this router to have internet for itself (put the IP of the main Router) | |
#uci set network.lan.proto='static' | |
uci set network.lan.netmask='255.255.255.0' | |
uci set network.lan.gateway='192.168.1.1' | |
uci set network.lan.dns='192.168.1.1' | |
# ======================================================== | |
# Optional, Disable IPv6 | |
# ======================================================== | |
uci del network.lan.ip6assign | |
uci set network.lan.delegate='0' | |
uci del dhcp.lan.dhcpv6 | |
uci del dhcp.lan.ra | |
uci del dhcp.odhcpd | |
/etc/init.d/odhcpd disable | |
/etc/init.d/odhcpd stop | |
# Disable DHCP just LAN: | |
uci set dhcp.lan.ignore=1 | |
uci del dhcp.lan.start | |
uci del dhcp.lan.limit | |
uci del dhcp.lan.leasetime | |
# Disable Dnsmasq completely (it is important to commit or discard dhcp) | |
uci commit dhcp; echo '' > /etc/config/dhcp | |
/etc/init.d/dnsmasq disable | |
/etc/init.d/dnsmasq stop | |
# ======================================================== | |
# Difference to a possibly third or even fourth AP | |
# ======================================================== | |
# and you could add as many as you want | |
uci set network.lan.ipaddr='192.168.1.3' # their static IP (starts at 2, because 1 is Main Router) | |
uci set system.@system[0].hostname='Repeater2' # Name, it is the 2nd repeater | |
uci set network.lan.hostname="`uci get system.@system[0].hostname`" # this just repeats the same as above | |
uci set wireless.@wifi-iface[0].ssid='Link2' # will be connected to AP emitting "Link2" (is the emitted by 1st repeater) | |
uci set wireless.@wifi-iface[2].ssid='Link3' # will allow other AP to be connected to this 2nd repeater (will be a 3rd repeater) | |
# Another one: | |
uci set network.lan.ipaddr='192.168.1.4' # their static IP (starts at 2, because 1 is Main Router) | |
uci set system.@system[0].hostname='Repeater3' # Name, it is the 2nd repeater | |
uci set network.lan.hostname="`uci get system.@system[0].hostname`" # this just repeats the same as above | |
uci set wireless.@wifi-iface[0].ssid='Link3' # will be connected to AP emitting "Link3" (is the emitted by 2nd repeater) | |
uci set wireless.@wifi-iface[2].ssid='Link4' # will allow other AP to be connected to this 3rd repeater (will be a 4th repeater) | |
# ======================================================== | |
# Commit changes, flush, and restart network | |
# ======================================================== | |
# This way we will get internet on this AP and we must reconnect | |
uci commit | |
sync | |
/etc/init.d/network restart | |
# If all is OK then reboot and test again: | |
reboot | |
# I used this configuration on four places with two and three repeaters... | |
# You could connect two AP to a same emitting link if it is required too. | |
# example, connect Repeater3 to MainRouter: | |
uci set network.lan.ipaddr='192.168.1.4' # their static IP (starts at 2, because 1 is Main Router) | |
uci set system.@system[0].hostname='Repeater3' # Name, it is the 2nd repeater | |
uci set network.lan.hostname="`uci get system.@system[0].hostname`" # this just repeats the same as above | |
uci set wireless.@wifi-iface[0].ssid='Link1' # will be connected to AP emitting "Link1" (is the emitted by MainRouter) | |
uci set wireless.@wifi-iface[2].ssid='Link4' # will allow other AP to be connected to this 3rd repeater (will be a 4th repeater) | |
# `system.@system[0].hostname` it is important in this kind of configuration to identify the box when you connect to ssh (reboot to see it) | |
# and `network.lan.hostname` it is important for identify in the network or with nslookup), you could use dhcp to assign IP to each AP | |
# but I do not recommend it since you will have to guess each time yo need to check or diagnose something. | |
# How to setup a Dumb AP, Wired backbone for OpenWRT / LEDE | |
https://gist.github.com/braian87b/bba9da3a7ac23c35b7f1eecafecdd47d | |
# How to setup Client Bridged / Client Mode / RelayD and IGMPProxy for OpenWRT / LEDE | |
https://gist.github.com/braian87b/821e9e4f399918510c55619192a31871 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@github535 Yes, I've done that, let me dig in my notes and collect those features on a single script detailing the config. Give me one or two days or better yet until next monday. I'll keep you posted.