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.
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.
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 clientmode has technical background on how this is accomplished.
- 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 uci and 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.
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 /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:
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'
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 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 /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 /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:
config interface 'lan' option ifname 'eth0' option type 'bridge' option proto 'dhcp'
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.
Once those steps are completed, we can setup the actual wireless link.
Edit the /etc/config/wireless file. In the
radio0 section, make sure that the wireless settings match the values in the access point.
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.
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.
config wifi-device 'radio0' option type 'mac80211' option macaddr 'unique device MAC address here -- NOT the same one as used in the access point configuration file' option hwmode '11ng' option htmode 'HT20' 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' 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'
See the configuration options for pointer on how to specify encryption and keys.
Disconnect the device from the wired network and reboot the device without any wired connection.
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.
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.
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)"
Relevant configuration files:
Multiple WDS Stations can connect to a single WDS Access Point.
- On the Access Point, add
option wds 1to the existing
wifi-ifacesection and proceed with configuring SSID, channel, encryption etc.
- On the Client, set
option wds 1to the
wifi-ifacesection. Disable the DHCP server, e.g. by adding
option ignore 1for LAN interface in /etc/config/dhcp.
- To create a repeater, add a WDS Access Point along with the WDS Station on the client,(with the same ssid and key, or not). Don't forget to add the newly created AP to the LAN firewall Zone.
On MAC80211 OpenWRT use 4 address (option wds 1) (with ap or sta mode) and not repeater mode. See also http://linuxwireless.org/en/users/Documentation/iw#Setting_up_a_WDS_peer
doc/recipes/atheroswds.txt · Last modified: 2014/09/05 13:01 by yuvadm