WordLinx - Get Paid To Click
Web hosting

Configuring OpenWrt as a Routed Wireless Client

 On Friday, November 1, 2013  

OpenWrt Configuring OpenWrt as a Routed Wireless Client This page contains an overview on how to configure a LinkSys WRT54GS running OpenWrt as a routed wireless client router. Introductory Information Firstly, be sure to have a look at Matt Kemner's guide to turning the Linksys WRT54G / WRT54GS into an AP-client and routing node. It provides a concise overview on how to configure OpenWrt as a client node, and was invaluable. Configuration Connecting to the WRT Assuming your WRT has just been flashed with OpenWrt firmware, you'll need to SSH to 192.168.1.1 to configure it. Remove the Firewall The default firewall on OpenWRT provides some basic inbound firewalling and NAT on the WAN interface. We don't want to use NAT, and will be implementing a more appropriate firewall later, so disable the existing firewall by preventing it from being executed: chmod 644 /etc/init.d/S45firewall Set Hostname Optionally, you can also set the hostname of the WRT: nvram set wan_hostname=MyWrt Network Configuration Setup WAN Port At this point, I configured the WAN port with a valid IP address on my home network, to me to complete the configuration, and to give the WRT internet access via my network (for installing additional packages). To configure the WAN (vlan1 interface) port, I used the following: nvram set wan_proto=static nvram set wan_ipaddr=10.60.11.151 nvram set wan_netmask=255.255.255.224 and set a default gateway and DNS server: nvram set wan_gateway=10.60.11.129 nvram set wan_dns=10.60.11.129 Commit the changes, and reboot: nvram commit reboot The WAN port was then connected to my switch, and I could telnet to the WRT on the IP address I had given to the WAN interface. Remove Bridge The default OpenWrt configuration has the wireless interface bridged with the LAN ports. To allow routing and firewalling between these interfaces, the bridge needs to be be removed. At the same time, we'll also rename the LAN ports to vlan0: nvram set lan_ifname=vlan0 nvram unset lan_ifnames Setup LAN Interface Now that the bridge has been removed, the LAN interface (vlan0) can be configured with a static IP address: nvram set lan_proto=static nvram set lan_ipaddr=10.60.68.17 nvram set lan_netmask=255.255.255.248 Setup Wireless Interface Similarly, the wireless interface (eth1) can be configured: nvram set wifi_ifname=eth1 nvram set wifi_proto=static nvram set wifi_ipaddr=10.60.68.234 nvram set wifi_netmask=255.255.255.252 nvram set wifi_gateway=10.60.68.233 nvram set wifi_dns=10.60.68.233 Rather than relying on the WRT to use decide which antenna socket to use, we'll force it to only use the main antenna socket, located next to the power socket (-1=auto, 0=main, 1=aux, 3=diversity): nvram set wl0_antdiv=0 Note that the antenna designations have changed in the various versions of the WRT. For earlier WRT54G/WRT54GS models, -1=auto, 0=main (next to power socket), 1=aux (next to reset button), 3=diversity. Starting with WRT54G v2.0 and WRT54GS V1.1 these are reversed 0=main (next to reset button) and 1=aux (next to power jack). Wireless Client Configuration Set Client Mode The wireless mode of the WRT can be set to ap (access point mode), sta (station/client mode), or wet (wireless ethernet bridge, ie, bridged client). As we're using it as a routed client, the mode gets set as follows: nvram set wl0_mode=sta When using sta or wet mode, you also need to specify if ad-hoc or infrastructure/managed mode is being used, with 0 used to specify ad-hoc mode, and 1 for managed mode: nvram set wl0_infra=1 Set the ESSID The ESSID of the wireless network to connect to needs to be specified: nvram set wl0_ssid=SGNet Save and Reboot Before continuing, commit all changes, and reboot the WRT: nvram commit reboot After the WRT has rebooted, verify that the configuration changes have been successfully applied. Testing Wireless Connectivity Using iwconfig iwconfig can be used to check the status of your wireless link, by running iwconfig eth1 If a wireless connection has been established by your WRT, the link quality should have a value greater than zero, and the signal and noise should have valid values: eth1 IEEE 802.11-DS ESSID:"SGNet" Mode:Master Frequency:2.437 GHz Access Point: 00:14:BF:94:C1:35 Tx-Power:19 dBm RTS thr=2347 B Fragment thr=2346 B Using wl An alternative way is to use a useful utility called wl. The wl utility provides more detail than iwconfig. Install wl using ipkg install wl Once installed, you can use wl to list all the wireless networks that are visible to your WRT, using wl scan; sleep 1; wl scanresults Assuming there is at least one wireless network visible, you should see output similar to SSID: "SGNet" Mode: Managed RSSI: -83 dBm noise: -94 dBm Channel: 13 BSSID: 00:0C:F1:96:C9:BD Capability: ESS Supported Rates: [ 1(b) 2(b) 5.5(b) 11(b) ] You can also use wl to join any wireless network, using wl join SGNet Additional Configuration Package List Assuming your WRT can access the internet, get it to update its ipkg database, and then retrieve a list of the available packages: ipkg update ipkg list Finalise Network Configuration Once a wireless connection was established, all further administration and configuration was done over the wireless link. Re-configure WAN Port The WAN port wasn't required, and hence was configured for on-site administration, to provide a way to locally access the WRT for configuration, if required. nvram set wan_proto=static nvram set wan_ipaddr=192.168.1.1 nvram set wan_netmask=255.255.255.0 nvram unset wan_gateway nvram unset wan_dns Save and Test These changes must be committed, and the WRT was rebooted to test the new configuration: nvram commit reboot
Configuring OpenWrt as a Routed Wireless Client 4.5 5 Unknown Friday, November 1, 2013 OpenWrt Configuring OpenWrt as a Routed Wireless Client This page contains an overview on how to configure a LinkSys WRT54GS running Ope...


No comments:

Post a Comment