PDA

Bekijk de volledige versie : AP mode but DHCP ?



krimskrams
01-08-2005, 17:01
Hi,

I want to use the Asus WL500g behind another router doing all the NAT/PPPoE stuff. But I need the WLAN part and the DHCP server of the WL500g.

With the last firmware 1.9.2.7-5a after enabling AP mode the DHCP server is switched off.

Is there any way to enable it again in AP mode?

As the WL500g is behind another router I managed to replace the gateway statement on the Asus to distribute the correct gateway address via DHCP. But it always adds itselfs as second DNS server, can I configure that somewhere?

Bye,

Christian

krimskrams
01-08-2005, 21:12
Hi,

after some hours of investigation I finally have the WL500g in AP Mode only, but DHCP is enabled and uses dynamic IP adresses as well as static entries for specific systems. Also the other router is the default gateway and the single DNS server propagated by DHCP.

The steup is a little tricky:

You need a custom firmware (which supports flashfs), I used 1.9.2.7 CR 6b.

Be sure that you are NOT in the AP mode, I used router mode.

Define all static (MAC based) IP assignements through the normal web interface and save it.

Log in to the router (I used telnet) and copy the files

/tmp/etc/dnsmasq.conf
/tmp/etc/resolv.conf
to /usr/local, then prepare the startup script:

mkdir -p /usr/local/sbin/
echo "#!/bin/sh" > /usr/local/sbin/post-boot
echo "dnsmasq -C /tmp/local/dnsmasq.conf" >> /usr/local/sbin/post-boot

As I only wanted to have a single DNS entry I changed /usr/local/resolv.conf to only have a single entry:

nameserver 192.168.123.254

Now do the necessary changes to /usr/local/dnsmasq.conf. In my case that was to point to my own resolv.conf, disable the /etc/hosts file and specify the path for the PID file. In addition I deleted the 0.0.0.0 entry from the dhcp-option 6, so only the same DNS server is promoted as stated in resolv.conf. Here is my dnsmasq.conf:


user=nobody
resolv-file=/tmp/local/resolv.conf
no-poll
no-hosts
cache-size=10
interface=br0
dhcp-leasefile=/tmp/dnsmasq.log
dhcp-range=lan,192.168.123.2,192.168.123.250,86400
dhcp-option=lan,6,192.168.123.254
dhcp-option=lan,3,192.168.123.254
read-ethers
dhcp-authoritative
pid-file=/tmp/var/run/dnsmasq.pid

The last configuration step is to include the static IP assignments which are stored in /etc/ethers. As dnsmasq does not allow to change this path I included the file itself:

echo "/etc/ethers" > /usr/local/.files

Finally store all the stuff in the flashfs:

flashfs save
flashfs commit
flashfs enable

Exit the telnet session and use the web interface again to change to AP mode and restart the WL500g.

Everything should work now!

Bye,

Christian

P.S.: The reason for switching between the modes is that in AP mode the file /etc/ethers is not visible ... so you cannot copy it :rolleyes:
So for changes in the flashfs image you need to change to router mode first, do the changes, save and commit the new flashfs image and then switch back to AP mode, otherwise you get an error from "flashfs save" and you will losse the /etc/ethers file.

wrc4
30-05-2007, 05:01
Thanks for the hints. (I wanted to do the similar thing on my WL-HDD so I did a search in this forum and found this post.)

Actually I found that after doing this, when the LAN cable is not connected, my AP will become 192.168.1.220 and assign IP to my clients. Later when you connect the LAN cable to your existing network, the AP will get a DHCP IP address. (Like 10.100.0.xxx) and if you refresh your clients' IP, they will get 10.100.0.xxx address too. This is very convinient in my usecase.