-
-
Save braian87b/8a524a8ad74a36407a8f481e9d16a5c9 to your computer and use it in GitHub Desktop.
# ==================================================================================== | |
# 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 |
Yes, some devices like iPhones or devices with other brand of wireless interfaces like intel or broadcom or mediatek sometimes does not like atheros WDS negociation or viceversa, but works fine, wireless devices just slow a little or disconnect sometimes.
It is flexible to use ssid instead of bssid if you need to replace a repeater, dont need to re-configure the other AP o or Client.
Sometimes is more practical to have different wireless shared keys, one for wireless links and one for devices.
This is needed only if you need Repeaters to have wireless connection, but it does not perform too well as with dumb AP using wired connection to each one. You will inmediatly start to notice bottleneck problems with many devices, more than 10 or 15... keep in mind that all connections will travel to just one physical wireless interface no matter what, This will happen if you have both configurations, one or more than one ssid.
Another option is to use a expensive router with more wireless throuput and dual band capabilites and more tx power and use just one repeater if needed.
But it is useful to use in a big home when you don't wanna wire all the place just put two or three cheap repeaters around and you are done.
Hi. Do you have a script for Dual-band router and client, using one band for LinkWDS/ClientWDS, the other band (same SSID between main-router and client-expander) is used for phone,tablet Wifi use (with transparent roaming) ? Thank you.
@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.
Is there any advantage in using multiple wifi interfaces for the link ap as opposed to just sharing the one wifi ap interface?
You can use the bssid to determine which link client connects to which ap. And a client can connect directly to a wds ap, not just a a std ap.
I've got a setup with the main router having only a ap with wds and a repeater with a client sta interface with wda bridged to a ap interface.