What's new
  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Help needed - dhcp server in AP mode

rayik

Occasional Visitor
Asus RT-N66. In Access Point mode DHCP server is disabled. I have been trying to enable dhcp server using jffs config file and startup script. I can not get it running correctly.

jffs is enabled and I can store files in it that survive reboot.

I created this dnsmasq.conf file in jffs. [ /jffs/configs/dnsmasq.conf ]:

Code:
dhcp-range=192.168.1.171,192.168.1.199,255.255.255.0,24h
dhcp-option=3,192.168.1.20
dhcp-option=6,208.67.222.222,208.67.220.200
dhcp-host=00:EA:24:EE:E2:B4,192.168.1.155,24h

I created this startup script services-start in jffs [ /jffs/scripts/services-start ]:

Code:
#!/bin/sh
killall dnsmasq
dnsmasq -c 1500 --log-async -n
touch /tmp/000dnsmasqstarted

ps | grep dns* shows that dnsmasq runs at startup (as does the 000dnsmasqstarted file being created in /tmp.

However, connecting devices are not getting any ip / dns from dhcp. I also tried naming the config file dnsmasq.config-add but that also did not work.

Thank you for your help.
 
Asus RT-N66. In Access Point mode DHCP server is disabled. I have been trying to enable dhcp server using jffs config file and startup script. I can not get it running correctly.

jffs is enabled and I can store files in it that survive reboot.

I created this dnsmasq.conf file in jffs. [ /jffs/configs/dnsmasq.conf ]:

Code:
dhcp-range=192.168.1.171,192.168.1.199,255.255.255.0,24h
dhcp-option=3,192.168.1.20
dhcp-option=6,208.67.222.222,208.67.220.200
dhcp-host=00:EA:24:EE:E2:B4,192.168.1.155,24h

I created this startup script services-start in jffs [ /jffs/scripts/services-start ]:

Code:
#!/bin/sh
killall dnsmasq
dnsmasq -c 1500 --log-async -n
touch /tmp/000dnsmasqstarted

ps | grep dns* shows that dnsmasq runs at startup (as does the 000dnsmasqstarted file being created in /tmp.

However, connecting devices are not getting any ip / dns from dhcp. I also tried naming the config file dnsmasq.config-add but that also did not work.

Thank you for your help.

Starting DNSmasq directly means it won't use the custom config file. You have to restart it through the firmware, which will take care of merging the default and the custom configs.

Code:
service restsart_dnsmasq
 
Thank you, but I'm still doing something wrong.

Dnsmasq does not run. I can telnet "service restart-dnsmasq" and the response is "done". However ps does not show dnsmasq running and if I run "killall dnsmasq" the message is "killall: dnsmasq: no process killed"

Files are

/jffs/configs/dnsmasq.conf

Code:
dhcp-range=192.168.1.171,192.168.1.199,255.255.255.0,24h
dhcp-option=3,192.168.1.20
dhcp-option=6,208.67.222.222,208.67.220.200
dhcp-host=00:EA:24:EE:E2:B4,192.168.1.155,24h


/jffs/scripts/services-start

Code:
#!/bin/sh
service restsart_dnsmasq
touch /tmp/000dnsmasqstarted

Again, thank you for your help.
 
/jffs/scripts/services-start

Code:
#!/bin/sh
service restsart_dnsmasq
touch /tmp/000dnsmasqstarted

There's a typo in that restart command.

Also I don't know if the router uses dnsmasq while in AP mode - I never tested AP mode myself.
 
Last edited:
Got it working. :)

Turns out it was not the typo that was the problem. It appears dnsmasq does not automatically start on bootup. Thus doing a restart command did nothing.

Just starting dmsmasq failed as there is no dnsmasq.conf file. I did /sbin/dnsmasq --help to see different startup options. Help showed you could manually configure a dnsmasq.conf file. Pointed to my jffs dnsmasq.conf file as a startup option and dhcp server is up and running.

This script works:

/jffs/scripts/services-start

Code:
#!/bin/sh
killall dnsmasq
dnsmasq --conf-file=/jffs/configs/dnsmasq.conf --log-async -n

I note from the help file you can also specify a static host file with: --addn-hosts=(path)

Working DHCP server survives restart.
 
Last edited:

Latest threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Back
Top