Differences

This shows you the differences between two versions of the page.

doc:recipes:atheroswds [2013/05/16 20:47]
xav0989 +additional_config
doc:recipes:atheroswds [2014/09/05 13:01] (current)
yuvadm
Line 1: Line 1:
-{{page>meta:infobox:construction&noheader&nofooter&noeditbtn}}+====== Atheros and MAC80211 WDS to implement a wireless network bridge ======
-====== Atheros and MAC80211 WDS ======+Most OpenWrt supported wireless drivers support since kernel 2.6 the AP-to-STA WDS mode to connect two or more devices using wireless bridging to form one common broadcast domain.
-Most OpenWrt supported wireless drivers support since kernel 2.6 the AP-to-STA WDS mode to connect two or more devices wirelessly to form one common broadcast domain.+With this configuration you will be able to wirelessly connect a remote wireless OpenWrt device (acting as the wireless station) to a local wireless OpenWrt point (acting as the wireless access point) and the wired devices connected to both devices will be on the same network and broadcast domain. Other wireless client devices can continue to connect to the wireless access point as before.
-With this configuration you will be able to connect a remote router (the station) to a local router (the access point) and the devices connected on both ends will be on the same network. Multiple stations can connect to the same +The method below is a layer 2 transparent bridge. All broadcast packets (such as DHCP requests) will be sent in both directions over the wireless bridge and the original source MAC address of the wired devices on both sides are preserved even over the bridge. The wiki article [[doc/howto/clientmode]] has technical background on how this is accomplished.
===== Configuration ===== ===== Configuration =====
 +
 +  * Tested with OpenWrt 12.09 using a TP-LINK TL-WR1043ND as the local wireless access point device and a Rosewill RNX-N300RT as the remote wireless client bridge device
With both [[doc:uci|uci]] and [[doc:howto:luci.essentials|luci]] the configuration of the network is split in two sections: the AP section and the STA section. It is important to follow the order of the steps as failure to do so could render the routers inopperable. With both [[doc:uci|uci]] and [[doc:howto:luci.essentials|luci]] the configuration of the network is split in two sections: the AP section and the STA section. It is important to follow the order of the steps as failure to do so could render the routers inopperable.
-==== Using UCI ====+==== Using SSH ====
=== The Access Point === === The Access Point ===
-Connect to the router that will serve as access point over ssh (using wires or wifi). It is most likely the one that connects to the internet. Once logged in, edit the [[doc:uci:wireless|/etc/config/wireless]] file. In the existing ''wifi-iface'' section that will be used, add a line with ''option wds 1''. If you haven't already done so, configure the SSID, channel, encryption, etc.+Connect to the router that will serve as the wireless access point over SSH. This is the device that connects to the internet or the main network using a wired connection. Ensure that the device is already set up as a normal wireless access point with a SSID, channel selection, WPA2 encryption as desired, etc. and that normal wireless clients can connect to it fine. 
 + 
 +Only one change is needed from a normal wireless access point configuration. 
 + 
 +Once logged in, edit the [[doc:uci:wireless|/etc/config/wireless]] file. In the existing ''wifi-iface'' section that is being used, add a line with ''option wds '1'''. 
 + 
 +Once that is done, save the file and reboot the device to restart all settings. 
 + 
 +Normal wireless clients should be able to connect to the wireless access point exactly as they did before and access the Internet. 
 + 
 +This is an example from /etc/config/wireless on the access point device: 
 + 
 +<code> 
 +config wifi-device 'radio0' 
 +        option type 'mac80211' 
 +        option macaddr 'unique device MAC address here' 
 +        option hwmode '11ng' 
 +        option htmode 'HT20' 
 +        list ht_capab 'SHORT-GI-40' 
 +        list ht_capab 'DSSS_CCK-40' 
 +        option txpower '27' 
 +        option channel '1' 
 +        option country 'CA' 
 + 
 +config wifi-iface 
 +        option device 'radio0' 
 +        option network 'lan' 
 +        option ssid 'my-wireless-ssid' 
 +        option encryption 'psk2' 
 +        option key 'wireless-secret-password' 
 +        option mode 'ap' 
 +        option wds '1' 
 +</code> 
 + 
 +After rebooting, the "ifconfig" command should show a new device named something like "wlan.staN" (where N is a number) in addition to the base "wlan0" wireless interface device. (**Note:** when tested on Barrier Breaker, there was no new interface created, neither on the AP nor on the STA, despite WDS working properly.) 
 + 
 +=== The remote wireless station === 
 + 
 +Initially connect to the router that will server as remote wireless station using an Ethernet cable. If you haven't already done so, [[doc:howto:generic.flashing|install openwrt]] and [[doc:howto:firstlogin|setup the password]]. SSH into the station. 
 + 
 +The first step is preparing the device for the bridging.  
 + 
 +If this is a new OpenWrt setup, a DHCP server is enabled on the lan interface of the device by default. This needs to be disabled before the device is connected to the production network (assuming the production network already has DHCP set up). To do so, edit the [[doc:uci:dhcp|/etc/config/dhcp]] file. Find the ''config dhcp 'lan''' section and add the line ''option ignore '1''' to this section. This will disable the DHCP server on the lan interface. (The lan DHCP section will look like the wan DHCP section, as the DHCP server is already disabled on the wan interface by default.) 
 + 
 +Following this, reconfigure the lan interface to have another address than the default static IP assignment of 192.168.1.1. Edit the [[doc:uci:network|/etc/config/network]] file. Set the IP to an another address from the same subnet. For example 192.168.1.2. After rebooting the router, remember to access the console & config via the new IP addess. 
 + 
 +Alternatively, you may try to let the router itself to fetch an  IP address via DHCP from the AP, but that may leave router inaccessible if the WDS connection does not work and that STA router does not reach the AP with DHCP. If you want to try that: in the ''lan'' section, remove the static IP configuration and reconfigure the interface to use DHCP. This is an example: 
 + 
 +<code> 
 +config interface 'lan' 
 +        option ifname 'eth0' 
 +        option type 'bridge' 
 +        option proto 'dhcp' 
 +</code>
-Once that is done, save the file and run ''uci commit wireless'' to save your changes. Reboot the device. Disconnect from the access point.+__**NOTE:**__ LAN interface can stay static ip but need to disable dhcp server for LAN interface. If set LAN interface to get ip from dhcp server then you have to search remote router ip each time you reboot it.
-=== The Station ===+Once those steps are completed, we can setup the actual wireless link.
-Connect using a wire to the router that will server as station. If you haven't already done so, [[doc:howto:generic.flashing|install openwrt]] and [[doc:howto:firstlogin|setup the password]]. SSH into the station.+Edit the [[doc:uci:wireless|/etc/config/wireless]] file. In the ''radio0'' section, make sure that the wireless settings match the values in the access point.
-The first step is preparing the network for the bridging. To do so, edit the [[doc:uci:dhcp|/etc/config/dhcp]] file. Find the ''lan'' section and add the ''option ignore 1'' line. This will disable the dhcp server (there would already be one on the access point). Following that, we must make sure that we can manage the station later on. To do so, we'll edit the [[doc:uci:network|/etc/config/network]] file. This assumes that you are using DHCP to give out addresses. In the ''lan'' section, two lines must be added:  +Further down in the same file, modify the ''wifi-iface'' section to include the desired SSID to which to connect (the same one as on the access point) and ensure WDS is enabled by setting this value to 1.
-    option proto 'dhcp' +
-    option hostname 'mystation' +
-where ''mystation'' is the name you want to give to your station. Make sure it's unique in your network.+
-Once those steps are completed, we can setup the actual wireless link. Edit the [[doc:uci:wireless|/etc/config/wireless]] file. In the ''radio0'' section, make sure that the ''type'', ''channel'' and ''country'' matches the values in the access point. You should edit the ''channel'' and ''country'' to match.+This is an example from /etc/config/wireless on the wireless client bridge device. The specific options may be different depending on the hardware but the SSID, channel, encryption type and password must match the access point, and WDS mode must be turned on.
-Further down in the same file, modify the ''wifi-iface'' section like so: +<code> 
-   option device 'radio0+config wifi-device 'radio0' 
-   option network 'lan+        option type 'mac80211' 
-   option mode 'sta+        option macaddr 'unique device MAC address here -- NOT the same one as used in the access point configuration file' 
-   option wds 1 +        option hwmode '11ng' 
-   option ssid 'NAME_OF_WIRElESS_NETWORK+        option htmode 'HT20' 
-where ''NAME_OF_WIRELESS_NETWORK'' is the name of the wifi network you setup in the access point. See the [[doc:uci:wireless#common.options1|configuration options]] for pointer on how to specify encryption and keys.+        list ht_capab 'SHORT-GI-20' 
 +        list ht_capab 'SHORT-GI-40
 +       list ht_capab 'TX-STBC
 +       list ht_capab 'RX-STBC1
 +       list ht_capab 'DSSS_CCK-40
 +       option txpower '27' 
 +       option country 'CA
 +       option channel '1' 
 +        option disabled '0'
-Reboot your station and you should be connected onto the LAN as soon as the station associates with the access point.+config wifi-iface 
 +        option device 'radio0' 
 +        option network 'lan' 
 +        option mode 'sta' 
 +        option wds '1' 
 +        option ssid 'my-wireless-ssid' 
 +        option encryption 'psk2' 
 +        option key 'wireless-secret-password' 
 +</code>
-=== Additional Station Configuration ===+See the [[doc:uci:wireless#common.options1|configuration options]] for pointer on how to specify encryption and keys.
-It is recommended to disable and uninstall dhcp and the firewall on the station. Since they are only necessary on the access point, removing them on the station will reduce the load and help reduce the possible problem sources. If the station should be re-purposed into a full fledged router, it is recommended that a clean install of openwrt (sysupgrade should suffice) be made.+Disconnect the device from the wired network and reboot the device without any wired connection.
-To remove dhcp (dnsmasq) and the firewall, issue the following commands in the shell: +The device should boot and automatically connect wirelessly to the access point. **Wait until the client bridge device associates with the access point. This can take 1-2 minutes for the association to happen.** Once this has happened, the **wired interface (e.g. eth0)** should succeed in getting a DHCP address through the new wireless bridge connection. Note that the wireless interface itself on the remote client bridge device does not get an IP address as it is now acting as a transparent bridge.
-    opkg update +
-    opkg --force-removal-of-dependent-packages dnsmasq iptables firewall kmod-ppp luci-proto-ppp +
-    rm /etc/config/dhcp+
-Reboot and you are set.+Any //wired devices// connected via Ethernet to the LAN ports on the remote client bridge device should now be transparently bridged into the main network over the wireless link.
==== LuCI ==== ==== LuCI ====
-TODO+Everything shown in the manual SSH configuration section above should be possible using LuCI in OpenWrt 12.09.
 +  * For the wireless access point, the wireless mode should be "Access Point (WDS)"
 +  * For the remote wireless bridge device, the wireless mode should be "Client (WDS)"
===== Old Stuff ===== ===== Old Stuff =====

Back to top

doc/recipes/atheroswds.1368730076.txt.bz2 · Last modified: 2013/05/16 20:47 by xav0989