What's new

DHCP Static-Lease Configuration from Command-line

  • 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!

gatorback

Regular Contributor
I would like command-line ability to configure the static leases found at the tail:

http://Router_IP/Advanced_DHCP_Content.asp

It would look something like:

https://www.dd-wrt.com/wiki/index.php/Static_DHCP#How_to_add_static_leases_into_dhcp_by_command

  1. Set the number of lease slots
  2. Fill in the data for each lease slot
https://www.dd-wrt.com/wiki/index.php/Static_DHCP#How_to_add_static_leases_into_dhcp_by_command
I set one static lease and tried:

router:/tmp/home/root# nvram show | grep static
vpn_crt_server2_static=
vpn_crt_client1_static=
size: 47431 bytes (18105 left)
vpn_crt_client2_static=
vpn_crt_client3_static=
lan_proto=static
dhcp1_staticlist=
vpn_crt_client4_static=
dhcp_staticlist=<99:52:99:22:9D:5B>192.168.8.110>MyHostname
dhcp_static_x=1
vpn_crt_client5_static=
dhcp1_static_x=0
vpn_crt_server1_static=

I set a second static host


outer:/tmp/home/root# nvram show | grep static
vpn_crt_server2_static=
vpn_crt_client1_static=
vpn_crt_client2_static=
vpn_crt_client3_static=
dhcp1_staticlist=
lan_proto=static
vpn_crt_client4_static=
dhcp_staticlist=<99:52:99:22:9D:5B>192.168.8.110>MyHostnameF<99:02:AF:72:CA:5B>192.168.8.111>NextHostname
dhcp_static_x=1
vpn_crt_client5_static=
dhcp1_static_x=0
vpn_crt_server1_static=
size: 47479 bytes (18057 left)

My Google search was not successful and I hope that others have already published this info. I look forward to seeing how this is done. Thanks
 
You need to restart dnsmasq to pick up the change,
Code:
service restart_dnsmasq

You'll probably also need to manually force the client to renew it's lease.
 
You need to restart dnsmasq:

Code:
service restart_dnsmasq
 
This is probably as good of place to start as any - dnsmasq is the dhcpd that sets leases...

OpenWRT info - https://wiki.openwrt.org/doc/uci/dhcp

Thanks for putting me on the right-track. Is there a good example that's applicable to Merlin's 378.58 on an RT-AC78U: I would prefer to be certain that I am doing this correctly and avoid an accidental borking of other services (DNS, etc.) I'd also like to understand where this configuration information is stored (NVRAM?) Thanks
 
Thanks for putting me on the right-track. Is there a good example that's applicable to Merlin's 378.58 on an RT-AC78U: I would prefer to be certain that I am doing this correctly and avoid an accidental borking of other services (DNS, etc.) I'd also like to understand where this configuration information is stored (NVRAM?) Thanks
I wouldn't use that page as a guide if I were you. OpenWRT uses a different method to configure DNS/DHCP with a different syntax. It's better to look at: http://www.thekelleys.org.uk/dnsmasq/docs/dnsmasq-man.html

The ASUS uses the "normal" dnsmasq configuration file at /etc/dnsmasq.conf. The firmware builds this file (and others) based on NVRAM settings at boot time.

For example, look at options --addn-hosts (/etc/hosts.dnsmasq) and --read-ethers (/etc/ethers)
 

Similar threads

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!
Top