Wednesday 29 August 2007

ASUS WL-500g as a wireless client/repeater

The Asus WL-500g router already had an old version of Openwrt White Russian firmware. I followed this advice from the Openwrt forums re installing Openwrt Kamikaze. Downloaded the appropriate firmware for the Asus WL-500g and loaded onto the router via the firmware upgrade function of webif (alternatively I could have used the the Asus upgrade utility).

After the usual logging on via telnet, changing root password etc described in the forum posting linked above, I followed the direction in this wiki article to configure the router as a wireless repeater.

Edited /etc/config/wireless -
config wifi-device wl0
option type broadcom
option channel 11

# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0

config wifi-iface
option device wl0
option network lan
option mode sta
option ssid NETGEAR
option encryption psk
option key LetterOfTheWeek

config wifi-iface
option device wl0
option network lan
option mode ap
option ssid Kitchen
option hidden 0
option encryption psk
option key LetterOfTheWeek
and /etc/config/network -
#### VLAN configuration
config switch eth0
option vlan0 "1 2 3 4 5*"
option vlan1 "0 5"

#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0

#### LAN configuration
config interface lan
option type bridge
option ifname "eth0"
option proto static
option ipaddr 192.168.1.101
option netmask 255.255.255.0
option gateway 192.168.1.1
option dns 192.168.1.1

#### WAN configuration
config interface wan
option proto none

- to set up the router as a client with WPA encryption on the existing AP with an SSID of 'NETGEAR' and also as an AP itself with SSID 'Kitchen' which repeats the traffic with WPA encryption.

When the router is configured like this and rebooted, it becomes a client to an existing AP with an SSID of 'NETGEAR'. This client interface, the wired router ports and the new AP with SSID 'Kitchen' are bridged together with an IP address of 192.168.1.101. Wired or wireless clients attached to this bridge get their IP configuration in the 192.168.1.xxx subnet via DHCP from the NETGEAR access point. The routing table on the router is -

root@kitchen:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan
default 192.168.1.1 0.0.0.0 UG 0 0 0 br-lan
and the interfaces are -

root@kitchen:~# ifconfig
br-lan Link encap:Ethernet HWaddr 00:11:2F:90:E9:C4
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:65205 errors:0 dropped:0 overruns:0 frame:0
TX packets:41138 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:33390624 (31.8 MiB) TX bytes:7736272 (7.3 MiB)

eth0 Link encap:Ethernet HWaddr 00:11:2F:90:E9:C4
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:5281 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:512332 (500.3 KiB)
Interrupt:3

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:232185 errors:0 dropped:0 overruns:0 frame:0
TX packets:232185 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:28677026 (27.3 MiB) TX bytes:28677026 (27.3 MiB)

wl0 Link encap:Ethernet HWaddr 00:11:2F:90:E9:C4
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:88661 errors:0 dropped:0 overruns:0 frame:92666
TX packets:74755 errors:17 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:46906044 (44.7 MiB) TX bytes:22477020 (21.4 MiB)
Interrupt:6 Base address:0x2000

wl0.1 Link encap:Ethernet HWaddr 00:11:2F:90:E9:C4
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

8 comments:

Unknown said...

Hi FlabbyBox,

I've got the same router and the same firmware and I wanted to do almost the same thing as you did, i.e. making the Asus an AP client and give its LAN ports in the same subnetwork with DHCP from main DSL router (in my case Linksys WAG200).

I see that my LAN ports do not get any IP address from DHCP. Have you changed there anything with dnsmasq or /etc/config/dhcp?

andrew said...

Hi Przemo,

I disabled dnsmasq from running on the WL-500g, so the DHCP requests from WL-500g LAN clients go up to the DHCP server on the main wireless access point.

Apart from that I didn't have to do anything special to set up for it just to work.

Does your WL-500g attach to wireles access point OK?

Unknown said...

Andrew,

Initially I turnt off both dnsmasq and firewall. Then I edited the /etc/config/dhcp and put the ignore 1 to both wan and lan.
The network file looks like this:

cat /etc/config/network
#### VLAN configuration
config switch eth0
option vlan0 "1 2 3 4 5*"
option vlan1 "0 5"


#### Loopback configuration
config interface loopback
option ifname "lo"
option proto static
option ipaddr 127.0.0.1
option netmask 255.0.0.0


#### LAN configuration
config interface lan
option type bridge
option ifname "eth0"
option proto static
option ipaddr '192.168.4.2'
option netmask 255.255.255.0
option gateway 192.168.4.1
option dns 192.168.4.1


#### WAN configuration
config interface wan
# option ifname "wl0"
# option type bridge
option proto none

the wireless is:
cat /etc/config/wireless
config wifi-device wl0
option type broadcom
option channel 1

# REMOVE THIS LINE TO ENABLE WIFI:
option disabled 0

config wifi-iface
option device wl0
option network lan
option mode sta
option ssid 'mynet'
option encryption psk
option key 'po435n3yu5'


But anyway all these LAN ports don't want to get anything from main router. Moreover, the static IP settings in my PC don't make it better as it doesn't connect to the net. I'm wondering that these interfaces (wl0 and eth0) are not connected to each other.

Unknown said...

Of course I've forgotten to tell that the router works correctly through WiFi and this is the way I connect to it. I am also wondering whether my main roueter, Linksys WAG200G, could make a problem with assigning the IPs through DHCP. But on the other hand if I put the static IP on a PC, it still cannot reach anything in LAN. I'm pinging other machines in LAN or some web portals but with no result:( No connection from LAN ports :(

andrew said...

Hi Przemo,

OK have you checked the bridge on the WL-500g has come up correctly? If you do ifconfig you should see an entry for br-lan with an ip address of 192.168.4.2

And if you do 'brctl show' you should see bridge name br-lan with interfaces eth0 and wl0

Unknown said...

Hi Andrew,

Maybe we could try using MSN? my login is przemoka(at)live.com.

I've found out a solution by using two subnetworks (192.168.4.xxx and 192.168.1.xxx) which are visible and all machines can ping each other. But this is temporary solution because everything should receive IP either from Linksys WAG200G or this ASUS (DHCP relay).

BTW, I've got ASUS WL-500g Premium but from the technical point of view, they are almost identical routers.
I hope to get a final solution for that so, hopefully, you'll have another great entry to your blog ;)

Unknown said...

Dear all,

If you want to do all these combinations with linux routers and Kamikaze, please do remember about downloading the original image from the main OpenWRT webpage. My case has proven that the downloads from different sites can cause many difficulties. My Kamikaze image was disruptive because it was a home-made build with some additional packages. Unfortunately, it was adding another device that probably caused all the problems I described here before.
When I installed the original image, added the remaining packages and configured according to Andrew's hints, everything started to work as it should have been.
So beware of any home-built images as they might not be working correctly and you'll waste plenty of time figuring out what's wrong.
Many thanks to Andrew for his help and support:)

Best regards,
Przemo

Unknown said...

Hi. Is it possible to use this router in WiFi Client Mode that means, get internet connection via WiFi, translate (NAT) and put on ethernet ports?
Another question, is it possible to to use ASUS WL-500g or any other such router, in Client Mode and AP Mode in same time? As I said before I'm getting internet connection via WiFi (with external antenna on the roof) and would like to use NAT and broadcast WiFi (after translation) in my appartment. I've heard it's possible using VLAN's? Do you know?