Differences

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

doc:recipes:relayclient [2013/03/18 22:41]
por corrected link to doc:uci:network
doc:recipes:relayclient [2014/06/15 13:12] (current)
spam-toaster
Line 8: Line 8:
{{:doc:howto:802.11-routed-relay.png|Relayd Topology}} {{:doc:howto:802.11-routed-relay.png|Relayd Topology}}
-The steps outlined below cover the process of putting the radio into client mode and linking it with the LAN interface with the help of //relayd//. +The steps outlined below cover the process of putting the radio into client mode and linking it with the LAN interface with the help of //relayd//. It is important to notice that the 192.168.2.0 network in the above picture is not gonna be used by any clients. But it is required for relayd to get it working, the lan interface must be in a different subnet.
- +
-:!: In order to use this setup, you first must install the ''relayd'' package, if it is not present on the system yet. In trunk versions it is also required to enable the relayd init script to function properly: ''/etc/init.d/relayd enable''.+
[[http://trac.gateworks.com/wiki/relayd|Configuration with Luci]] :!: When using Luci you also need to install the ''luci-proto-relay'' package.\\ [[http://trac.gateworks.com/wiki/relayd|Configuration with Luci]] :!: When using Luci you also need to install the ''luci-proto-relay'' package.\\
-[[https://forum.openwrt.org/viewtopic.php?pid=173467#p173467|OpenWrt PseudoBridge HowTo]] for TL-WR703n or any other device based on package ''relayd'' and ''luci-proto-relay''. +[[https://forum.openwrt.org/viewtopic.php?pid=173467#p173467|OpenWrt PseudoBridge HowTo]] for TL-WR703n or any other device based on package ''relayd'' and ''luci-proto-relay''.\\ 
 +[[https://forum.openwrt.org/viewtopic.php?id=39077|Repeater configurations here! Both ways, bridged and simple repeater]].
===== Configuration ===== ===== Configuration =====
Line 35: Line 34:
-Now we can issue the ''iwlist scan'' command to list networks in range, the required information is highlighted:+Now we can list networks in range using: 
 +  * in OpenWrt 10.03 and previous, use: ''iwlist scan'' 
 +  * in 12.09, substituting your actual wireless interface for //wlan0// if different: ''iw dev wlan0 scan'' 
 +    * ''ifconfig'' lists all available interfaces if //wlan0// is not correct
 +===='iwlist scan' output example====
| ''root@OpenWrt:~# iwlist scan | ''root@OpenWrt:~# iwlist scan
wlan0    Scan completed : wlan0    Scan completed :
Line 120: Line 123:
    * If both WPA and WPA2 are present, the network is most likely operating in WPA/WPA2 mixed mode     * If both WPA and WPA2 are present, the network is most likely operating in WPA/WPA2 mixed mode
 +===='iw dev wlan0 scan' output example====
 +
 +        root@OpenWrt:~# iw dev wlan0 scan
 +        BSS c1:9e:db:ff:af:ad(on wlan0)
 +                TSF: 71481395591 usec (0d, 19:51:21)
 +                freq: 2412
 +                beacon interval: 100 TUs
 +                capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
 +                signal: -56.00 dBm
 +                last seen: 660 ms ago
 +                Information elements from Probe Response frame:
 +                SSID: HogardeDolly
 +                Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0* 9.0 12.0* 18.0
 +                DS Parameter set: channel 1
 +                ERP: <no flags>
 +                ERP D4.0: <no flags>
 +                RSN:    * Version: 1
 +                        * Group cipher: TKIP
 +                        * Pairwise ciphers: CCMP TKIP
 +                        * Authentication suites: PSK
 +                        * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
 +                Extended supported rates: 24.0* 36.0 48.0 54.0
 +                HT capabilities:
 +                        Capabilities: 0x11ce
 +                                HT20/HT40
 +                                SM Power Save disabled
 +                                RX HT40 SGI
 +                                TX STBC
 +                                RX STBC 1-stream
 +                                Max AMSDU length: 3839 bytes
 +                                DSSS/CCK HT40
 +                        Maximum RX AMPDU length 65535 bytes (exponent: 0x003)
 +                        Minimum RX AMPDU time spacing: 8 usec (0x06)
 +                        HT RX MCS rate indexes supported: 0-15
 +                        HT TX MCS rate indexes are undefined
 +                HT operation:
 +                        * primary channel: 1
 +                        * secondary channel offset: above
 +                        * STA channel width: any
 +                        * RIFS: 1
 +                        * HT protection: no
 +                        * non-GF present: 1
 +                        * OBSS non-GF present: 0
 +                        * dual beacon: 0
 +                        * dual CTS protection: 0
 +                        * STBC beacon: 0
 +                        * L-SIG TXOP Prot: 0
 +                        * PCO active: 0
 +                        * PCO phase: 0
 +                WPA:    * Version: 1
 +                        * Group cipher: TKIP
 +                        * Pairwise ciphers: CCMP TKIP
 +                        * Authentication suites: PSK
 +                WMM:    * Parameter version 1
 +                        * BE: CW 15-63, AIFSN 3
 +                        * BK: CW 15-1023, AIFSN 7
 +                        * VI: CW 7-15, AIFSN 1, TXOP 3008 usec
 +                        * VO: CW 3-7, AIFSN 1, TXOP 1504 usec
 +        BSS 31:ff:1e:36:ed:21(on wlan0)
 +                TSF: 36618930211 usec (0d, 10:10:18)
 +                freq: 2437
 +                beacon interval: 100 TUs
 +                capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431)
 +                signal: -70.00 dBm
 +                last seen: 380 ms ago
 +                Information elements from Probe Response frame:
 +                SSID: uFi_06ED61
 +                Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0
 +                DS Parameter set: channel 6
 +                Country: HK    Environment: bogus
 +                        Channels [1 - 13] @ 20 dBm
 +                ERP: <no flags>
 +                Extended supported rates: 24.0 36.0 48.0 54.0
 +                HT capabilities:
 +                        Capabilities: 0x0c
 +                                HT20
 +                                SM Power Save disabled
 +                                No RX STBC
 +                                Max AMSDU length: 3839 bytes
 +                                No DSSS/CCK HT40
 +                        Maximum RX AMPDU length 8191 bytes (exponent: 0x000)
 +                        Minimum RX AMPDU time spacing: No restriction (0x00)
 +                        HT RX MCS rate indexes supported: 0-7
 +                        HT TX MCS rate indexes are undefined
 +                HT operation:
 +                        * primary channel: 6
 +                        * secondary channel offset: no secondary
 +                        * STA channel width: 20 MHz
 +                        * RIFS: 0
 +                        * HT protection: nonmember
 +                        * non-GF present: 0
 +                        * OBSS non-GF present: 0
 +                        * dual beacon: 0
 +                        * dual CTS protection: 0
 +                        * STBC beacon: 0
 +                        * L-SIG TXOP Prot: 0
 +                        * PCO active: 0
 +                        * PCO phase: 0
 +                WPA:    * Version: 1
 +                        * Group cipher: TKIP
 +                        * Pairwise ciphers: CCMP TKIP
 +                        * Authentication suites: PSK
 +                RSN:    * Version: 1
 +                        * Group cipher: TKIP
 +                        * Pairwise ciphers: CCMP TKIP
 +                        * Authentication suites: PSK
 +                        * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
 +                WMM:    * Parameter version 1
 +                        * BE: CW 15-1023, AIFSN 3
 +                        * BK: CW 15-1023, AIFSN 7
 +                        * VI: CW 7-15, AIFSN 2, TXOP 3008 usec
 +                        * VO: CW 3-7, AIFSN 2, TXOP 1504 usec
 +                WPS:    * Version: 1.0
 +                        * Wi-Fi Protected Setup State: 2 (Configured)
 +                        * Response Type: 3 (AP)
 +                        * UUID: f23a0b52-48fc-5f20-9a5b-3cd27cf64566
 +                        * Manufacturer: ZTE
 +                        * Model: AR6003
 +                        * Model Number:
 +                        * Serial Number:
 +                        * Primary Device Type: 6-0050f204-1
 +                        * Device name: ZTE-AP
 +                        * Config methods: Label, Display, PBC, Keypad
 +                        * RF Bands: 0x1
 +        root@OpenWrt:~#
==== Step 1: Create an interface for the wireless station ==== ==== Step 1: Create an interface for the wireless station ====
Line 137: Line 265:
</code> </code>
-==== Step 2: Declare a relay interface ==== 
-Add another new interface to the network configuration, this time with the special protocol ''relay'': +==== Step 2: Change the existing wireless network ====
- +
-| ''config 'interface' 'stabridge' +
-        option 'proto'      'relay' +
-        option 'network'    'lan **wwan**' '' | +
- +
-The existing ''lan'' network and the newly created ''wwan'' network are grouped together here. +
- +
-UCI CLI commands: +
-<code> +
-uci set network.stabridge=interface +
-uci set network.stabridge.proto=relay +
-uci set network.stabridge.network="lan wwan" +
-uci commit network +
-</code> +
- +
-==== Step 3: Change the existing wireless network ====+
Supposed we want to connect to the network called "xmff-relay", the previous scan result revealed the following information: Supposed we want to connect to the network called "xmff-relay", the previous scan result revealed the following information:
Line 190: Line 301:
</code> </code>
 +Finally restart wifi using:
 +<code>
 +wifi down; wifi
 +</code>
 +Note that if you receive ''device or resource busy'' or ''command not found'' errors, you may need to issue a ''reboot'' command and reconnect before continuing.  If you have connected successfully to the existing network, ''ifconfig'' should reveal that //wlan0// (or whatever your wireless interface is called) has an IP address on the existing wireless network.
 +You should now be connected to the internet (you will need such connection for step 3).
 +==== Step 3: Install relayd ====
 +If the ''relayd'' package is not present on the system yet, install it using:
 +<code>
 +opkg update
 +opkg install relayd
 +</code>
 +In 12.09 and trunk versions it is also required to enable the relayd init script to function properly:
 +<code>
 +/etc/init.d/relayd enable
 +</code>
 +==== Step 4: Declare a relay interface ====
 +Back to ''/etc/config/network'' add another new interface, this time with the special protocol ''relay'':
 +| ''config 'interface' 'stabridge'
 +        option 'proto'      'relay'
 +        option 'network'    'lan **wwan**' '' |
 +
 +The existing ''lan'' network and the newly created ''wwan'' network are grouped together here.
 +
 +UCI CLI commands:
 +<code>
 +uci set network.stabridge=interface
 +uci set network.stabridge.proto=relay
 +uci set network.stabridge.network="lan wwan"
 +uci commit network
 +</code>
 +
 +==== Step 5: Add gateway and dns to the lan interface ====
 +
 +Find the IP address of default gateway for the network you will be repeating. You should be connected to it since step 3, thus you can use the route command to find out:
 +<code>
 +route -n | grep UG
 +</code>
 +
 +Then, still in the network configuration, add the following options under your lan interface, substituting gateway with the IP you just found:
 +
 +| ''config 'interface' 'lan'
 +        option gateway '192.168.1.1'
 +        option dns    '192.168.1.1' '' |
 +
 +UCI CLI commands:
 +<code>
 +uci set network.lan.gateway=192.168.1.1
 +uci set network.lan.dns=192.168.1.1
 +uci commit network
 +</code>
 +Please note, the ip address of this router (and only this!) must be in a different subnet than your existing main network, otherwise relayd will not work. This will be changed later (see below in chapter "apply changes"). This safes us an additional change on administration PC to match subnet. Note also: On final configuration, any clients on OpenWrt will use the same ip range of your main network.
-==== Step 4: Disable the local DHCP server ====+==== Step 6: Disable the local DHCP server ====
Since DHCP requests from LAN will be answered by the wireless AP the router is connecting to, Since DHCP requests from LAN will be answered by the wireless AP the router is connecting to,
Line 218: Line 381:
uci commit dhcp</code> uci commit dhcp</code>
-==== Step 5: Adjust the firewall ====+==== Step 7: Adjust the firewall ====
In contrast to true bridging, packets forwarded by //relayd// are handled by the normal routing In contrast to true bridging, packets forwarded by //relayd// are handled by the normal routing
Line 243: Line 406:
uci set firewall.@zone[0].network="lan wwan" uci set firewall.@zone[0].network="lan wwan"
uci commit firewall</code> uci commit firewall</code>
 +
 +==== Step 8: Create a wireless network for repeating (optional) ====
 +
 +If your equipment is multi-SSID capable, besides the wired interface, you can also bridge the network into a new wireless network. Just create a new network in access point (AP) mode under ''/etc/config/wireless'':
 +
 +|''config wifi-iface
 +    option device 'radio0'
 +    option mode 'ap'
 +    option ssid 'RepeaterWirelessNetwork'
 +    option encryption 'psk2'
 +    option key 'RepeaterWirelessPassword'
 +    option network 'lan' ''|
 +
 +UCI CLI commands:
 +<code>
 +uci set wireless.@wifi-iface[1].device=radio0
 +uci set wireless.@wifi-iface[1].network=lan
 +uci set wireless.@wifi-iface[1].mode=ap
 +uci set wireless.@wifi-iface[1].ssid=RepeaterWirelessNetwork
 +uci set wireless.@wifi-iface[1].encryption=psk2
 +uci set wireless.@wifi-iface[1].key=RepeaterWirelessPassword
 +uci commit wireless
 +</code>
===== Apply changes ===== ===== Apply changes =====
Line 258: Line 444:
<code>wifi down; wifi</code> <code>wifi down; wifi</code>
-| {{:meta:48px-dialog-warning.svg.png?nolink}} | If the target network uses the 192.168.1.0/24 subnet, you **must** change the default LAN IP address to a different subnet, e.g. 192.168.**2**.1 .\\ You can determine the assigned wifi address with the following command: <code>uci -P/var/state get network.wwan.ipaddr +Finally we will need to change our ip on the lan interface. 
-10.11.12.35</code> UCI CLI commands to change the default LAN IP address to a different subnet is: <code> + 
-uci set network.lan.ipaddr=192.168.2.1+| {{:meta:48px-dialog-warning.svg.png?nolink}} | It is required that the lan interface on this router is in another subnet than your main network .\\ If the target network uses the 192.168.1.0/24 subnet, you **must** change the LAN IP address (not the gateway) to a different subnet, e.g. 192.168.**2**.1 .\\ You can determine the assigned wifi address with the following command: <code>uci -P/var/state get network.wwan.ipaddr</code> <code bash>. /lib/functions/network.sh; network_get_ipaddr ip_wwan wwan; echo $ip_wwan</code> UCI CLI commands to change the default LAN IP address to a different subnet is: <code>uci set network.lan.ipaddr=192.168.2.1
uci commit network uci commit network
reboot</code> | reboot</code> |
Line 266: Line 452:
At this point, the relayed client configuration should be finished. At this point, the relayed client configuration should be finished.
-=====Enable access from main network===== +=====Enable access from client network===== 
-After this the relay should work, however you will have trouble reaching the router from the main network. To get to it you'll need to manually set the IP address on your computer to an IP address on the same subnet (like 192.168.2.201 if you set the router ip to 192.168.2.1).+After this the relay should work, however you will have trouble reaching the router from the client network if the client ip is not changed. To get to it you'll need to manually set the IP address on your computer to an IP address on the same subnet (like 192.168.2.201 if you set the router lan ip to 192.168.2.1).
-This is kind of tedious, but you can set things up so you can get it from the main network.+This is kind of tedious, but you can set things up so you can get it from the client network.
-Run ''ifconfig'' and take note of the IP address assigned to wlan0. Then tell the relayd that this is the routers IP address with the following config.+Run ''ifconfig'' and take note of the IP address assigned to wlan0. Then tell the relayd that this is the routers IP address with the following config in /etc/config/network:
 +|''config interface 'stabridge'
 +    option ipaddr '192.168.1.35' ''|
 +
 +UCI CLI commands:
<code> <code>
uci set network.stabridge.ipaddr=192.168.1.35 uci set network.stabridge.ipaddr=192.168.1.35

Back to top

doc/recipes/relayclient.1363642907.txt.bz2 · Last modified: 2013/03/18 22:41 by por