What's new

Backup Manual DHCP List?

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

Going back to the original poster's question, I have a suggestion.

If you create a file called /jffs/configs/dnsmasq.conf.add with this line:
dhcp-hostsfile=/jffs/etc/dnsmasq/static_leases

Then you can put all your manual DHCP leases into this file /jffs/etc/dnsmasq/static_leases which will survive firmware resets and is easily maintained using nano or vi.

The format of the static_leases file is:
xx:xx:xx:xx:xx:xx,hostname,a.b.c.d,time_to_live

for example:
00:0C:29:41:AA:BB,barney,192.168.0.50,10080m

I'm curious - does this work with the RT-AC68U in terms of the format of the file?
The reason I ask is that, running nvram get dhcp_staticlist, all I get is the MAC address and the IP address. No hostname or TTL.

I would like to bind the hostname to the IP/MAC setting on the 68U.
 
I'm curious - does this work with the RT-AC68U in terms of the format of the file?
The reason I ask is that, running nvram get dhcp_staticlist, all I get is the MAC address and the IP address. No hostname or TTL.

I would like to bind the hostname to the IP/MAC setting on the 68U.

Those are two different things. He's talking about the dnsmasq config. You are talking about the webui config.
 
Those are two different things. He's talking about the dnsmasq config. You are talking about the webui config.

I see. So, will the dnsmasq hosts file override the webui config? Should I use one over the other or just make sure both are in sync?
 
The firmware uses the addn-hosts config setting in dnsmasq.conf to provide the webui static reservations. No idea how it will interact with adding your own entries, you will have to see the dnsmasq documentation.
 
Going back to the original poster's question, I have a suggestion.

If you create a file called /jffs/configs/dnsmasq.conf.add with this line:
dhcp-hostsfile=/jffs/etc/dnsmasq/static_leases

Then you can put all your manual DHCP leases into this file /jffs/etc/dnsmasq/static_leases which will survive firmware resets and is easily maintained using nano or vi.

I am totally new to Linux so pardon my ignorance however the directory "/jffs/etc/dnsmasq/" does not exist on my router. Do I have to create it or can I use an existing directory??

This is what I have so far but it fails because "Directory does not exist.... "

1) echo "dhcp-hostsfile=/jffs/etc/dnsmasq/static_leases" >> /jffs/configs/dnsmasq.conf.add
2) echo "EC:1A:59:68:5D:19,Foyer Motion,192.168.1.201,10080m" >> /jffs/etc/dnsmasq/static_leases

Step 2 fails....
 
Last edited:
Of course, you have to create the directory before running 2nd line. For this example by running this:
Code:
mkdir /jffs/etc
mkdir /jffs/etc/dnsmasq
 
Of course, you have to create the directory before running 2nd line. For this example by running this:
Code:
mkdir /jffs/etc
mkdir /jffs/etc/dnsmasq

Custom config files must go into /jffs/configs/ if you want the firmware to automatically pick it up.
 
Custom config files must go into /jffs/configs/ if you want the firmware to automatically pick it up.
You are right and my message is completely in line with it. There was an example for /jffs/configs/dnsmasq.conf.add file with row
Code:
dhcp-hostsfile=/jffs/[B]etc/dnsmasq[/B]/static_leases
so it is the reason I gave him this help. It's just the directory for static_leases data file not dnsmasq.conf.add one. It should prevent him from the error message he's got.
 
You are right and my message is completely in line with it. There was an example for /jffs/configs/dnsmasq.conf.add file with row
Code:
dhcp-hostsfile=/jffs/[B]etc/dnsmasq[/B]/static_leases
so it is the reason I gave him this help. It's just the directory for static_leases data file not dnsmasq.conf.add one. It should prevent him from the error message he's got.

I had figured as much but I was reluctant to make any changes to my router without confirmation. For all I know creating the directory and not setting proper privileges and my router will no longer boot without errors:D
 
Ok so I run the nvram get dhcp_staticlist command via Tools\Run CMD on my router.

The response is <MAC>IP.IP.IP.IP>HostName<MAC>IP>Hostname etc

I can save that single line off some place. If I just want to restore that single line and nothing else (and not backup the entire nvram to a settings file) would I just run:

nvram set dhcp_staticlist="long string from above with 20 or so MACs/IPs/Hosts"
nvram commit
 
Ok so I run the nvram get dhcp_staticlist command via Tools\Run CMD on my router.

The response is <MAC>IP.IP.IP.IP>HostName<MAC>IP>Hostname etc

I can save that single line off some place. If I just want to restore that single line and nothing else (and not backup the entire nvram to a settings file) would I just run:

nvram set dhcp_staticlist="long string from above with 20 or so MACs/IPs/Hosts"
nvram commit

correct

10char
 
Going back to the original poster's question, I have a suggestion.

If you create a file called /jffs/configs/dnsmasq.conf.add with this line:
dhcp-hostsfile=/jffs/etc/dnsmasq/static_leases

Then you can put all your manual DHCP leases into this file /jffs/etc/dnsmasq/static_leases which will survive firmware resets and is easily maintained using nano or vi.

The format of the static_leases file is:
xx:xx:xx:xx:xx:xx,hostname,a.b.c.d,time_to_live

for example:
00:0C:29:41:AA:BB,barney,192.168.0.50,10080m

I use this exact format for static_leases and get "bad DHCP host name at line 1 of /jffs/etc/dnsmasq/static_leases"

The Line I use is:"a4:ba:db:fb:84:ae,ALIENWAREPC,192.168.1.230,10080m"

Router: N66U, FW:3.0.0.4.374.39 (Merlin build)
 
Ok so I run the nvram get dhcp_staticlist command via Tools\Run CMD on my router.

The response is <MAC>IP.IP.IP.IP>HostName<MAC>IP>Hostname etc

I can save that single line off some place. If I just want to restore that single line and nothing else (and not backup the entire nvram to a settings file) would I just run:

nvram set dhcp_staticlist="long string from above with 20 or so MACs/IPs/Hosts"
nvram commit

I tried the above method as well however my line is too long. If I cut the list I got from "nvram get dhcp_staticlist" in half it works fine but I need a means to get the entire list back in.
 
I tried the above method as well however my line is too long. If I cut the list I got from "nvram get dhcp_staticlist" in half it works fine but I need a means to get the entire list back in.

Same problem here. It's not possible to paste the full output of "nvram get dhcp_staticlist" in the "Tools - Run System Command". And it doesn't seem possible to chop it up in several parts either, because only the last ran command(nvram set dhcp_staticlist) is applied...

Any tip on how to get the whole list back?
 
Same problem here. It's not possible to paste the full output of "nvram get dhcp_staticlist" in the "Tools - Run System Command". And it doesn't seem possible to chop it up in several parts either, because only the last ran command(nvram set dhcp_staticlist) is applied...

Any tip on how to get the whole list back?

I use a script maintained on Windows Norepad++ and simply dragged/dropped into /jffs/scripts using WinSCP

Code:
#!/bin/sh

# Martineau Refresh a sorted list of the DHCP STATIC table

logger -t "($(basename $0))" DHCP static table reset

nvram set dhcp_staticlist="<xx:xx:xx:xx:xx:xx>nnn.nnn.nnn.nnn>Name1<xx:xx:xx:xx:xx:xx>nnn.nnn.nnn.nnn>Name2   < repeat etc. "

nvram commit

I have currently 29 devices defined.. and sorted by I/P! :)

Regards,
 
You can break the data up into multiple lines using a (\) backslash.
Example
nvram set dhcp_staticlist="<xx:xx:xx:xx:xx:xx>192.168.1.200>Nest Thermostat<xx:xx:xx:xx:xx:xx>192.168.1.201>Foyer Motion<xx:xx:xx:xx:xx:xx>192.168.1.224>Kathys iPad \
<xx:xx:xx:xx:xx:xx>iPhone 2<xx:xx:xx:xx:xx:xx>192.168.1.249>Balboa Spa"
nvram commit
 
You can break the data up into multiple lines using a (\) backslash.
Example
nvram set dhcp_staticlist="<xx:xx:xx:xx:xx:xx>192.168.1.200>Nest Thermostat<xx:xx:xx:xx:xx:xx>192.168.1.201>Foyer Motion<xx:xx:xx:xx:xx:xx>192.168.1.224>Kathys iPad \
<xx:xx:xx:xx:xx:xx>iPhone 2<xx:xx:xx:xx:xx:xx>192.168.1.249>Balboa Spa"
nvram commit

How do I put this in Tools - Run System Command? It doesn't allow everything in one row. I am a noob, so please be more specific on how to input this in the Run Command view.
 
How do I put this in Tools - Run System Command? It doesn't allow everything in one row. I am a noob, so please be more specific on how to input this in the Run Command view.


Hhhm. I used putty.exe not the "Tools/Run Cmd". Under Admin/system enable JFFS+Format JFFS+Telnet+SSH then download putty, install and connect SSH.
once you log on you can paste your list at the command prompt
i.e (assuming your list is broken into 2 lines

Line 1 = nvram set dhcp_staticlist="<xx:xx:xx:xx>192.168.1.200>Nest............ \ (Note backslash followed by <enter>)

Line 2> xx:xx:xx:xx>192.168.1.222>whatever..... " (Note Quote followed by <enter>)
 
How can we do this on the N66U now that the command line tab has been removed?
 
Last edited:

Latest threads

Sign Up For SNBForums Daily Digest

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