Posted: Thu May 14, 2020 13:44 Post subject: R7500v2 Is there a way to save the static DHCP lease table?
[Solved]
I bought a R7500v2 awhile back (coming from a WNDR4500 ->R6300 ->R6400 -> R7500v2)
So all of my other older router were Netgear but they were all Broadcom devices while the R7500v2 is an Atheros device.
Anyway I have about 25 devices on the static lease table on the "Services" tab.
I usually just take a screen shot and re-enter them manually but I am getting tired of doing that every time I need to do a full reset.
So there has to be a way to export or backup/save the DHCP lease table
I have the "Use NVRAM for client lease DB" box checked so there must be a way to backup just that portion of the NVRAM to a file that I can use to restore my long list of DHCP clients.
Thanks and be nice! manual code entering and Linux commands are not really known to me they are like learning a foreign language. If you post exactly what I have to enter and where I enter the code I can learn for that. Thanks again
Last edited by Format_C on Sat May 16, 2020 9:38; edited 1 time in total
Joined: 05 Oct 2008 Posts: 666 Location: Helsinki, Finland / nr. Alkmaar, Netherlands
Posted: Thu May 14, 2020 14:17 Post subject:
I use a file defined in the additional DNSMasq options field.
# Static leases are defined in the following file on the USB stick
# (samba name JFFS2):
conf-file=/jffs/dnsmasq.custom
I made the JFFS thumbstick already years ago and can't tell you if the other stuff on it is relevant to this subject, but the partitions on the thumbstick are mounted by the firmware.
The firmware just reads the dnsmasq.custom from the thumbstick.
I access the thumstick using SMB from my laptop in order to edit the DNSMasq.custom file.
The firmware writes its dnsmasq.leases file to the JFFS partition by virtue of the relevant option on the same GUI page as the additional DNSMasq options.
Here are some lines from my custom file:
# DNSMASQ WILL FAIL if there are leading zeroes in IP addresses,
# or characters other than letters, numbers and hyphens in a device name!!!
# This file is linked using an option in Additional Dnsmasq Options:
# conf-file=/jffs/dnsmasq.custom
# Edit this file (on the JFFS partition of the router) if desired and
# hit Apply Settings on the Services, Services page in the DD-WRT GUI
# (or reboot the router).
#
As you can see, you can list two MAC addresses for one machine, if you like (LAN and WLAN). If you omit the IP-address, DHCP will hand out one after its own choice.
You can also copy-paste the dhcp-host lines from a text file into the additional options field and do away with the thumbdrive.
You can also copy-paste the dhcp-host lines from a text file into the additional options field and do away with the thumbdrive.
I did this. I took out all the manual entries in the table on that page and instead had all the entries listed in the additional options field. I had SSH keys on that page that needed to be saved as well, so I just have a text document on my computer with all of that info and if I ever need to do a full reset, I can copy/paste back into those fields.
There is an issue with the UI not displaying the hostnames correctly (at all) if you use this method. There's no functional loss, but I missed not being able to see the hostnames on screen — so much so that I went back to the old way of manually putting them in the table, all 30+ of them.
If that's not a bother for you, the "additional options" route is certainly a good way to go.
I use a file defined in the additional DNSMasq options field.
# Static leases are defined in the following file on the USB stick
# (samba name JFFS2):
conf-file=/jffs/dnsmasq.custom
I made the JFFS thumbstick already years ago and can't tell you if the other stuff on it is relevant to this subject, but the partitions on the thumbstick are mounted by the firmware.
The firmware just reads the dnsmasq.custom from the thumbstick.
I access the thumstick using SMB from my laptop in order to edit the DNSMasq.custom file.
The firmware writes its dnsmasq.leases file to the JFFS partition by virtue of the relevant option on the same GUI page as the additional DNSMasq options.
Here are some lines from my custom file:
# DNSMASQ WILL FAIL if there are leading zeroes in IP addresses,
# or characters other than letters, numbers and hyphens in a device name!!!
# This file is linked using an option in Additional Dnsmasq Options:
# conf-file=/jffs/dnsmasq.custom
# Edit this file (on the JFFS partition of the router) if desired and
# hit Apply Settings on the Services, Services page in the DD-WRT GUI
# (or reboot the router).
#
As you can see, you can list two MAC addresses for one machine, if you like (LAN and WLAN). If you omit the IP-address, DHCP will hand out one after its own choice.
You can also copy-paste the dhcp-host lines from a text file into the additional options field and do away with the thumbdrive.
OK I like this approach to the issue at hand, but does it actually need a USB flash drive to work?
I have quite a few of them but I don't want to tie up one just for this purpose.
I will if I absolutely need to though. The smallest (capacity not physical size) is 4GB so that should be enough for those files
Joined: 05 Oct 2008 Posts: 666 Location: Helsinki, Finland / nr. Alkmaar, Netherlands
Posted: Thu May 14, 2020 17:14 Post subject:
Format_C wrote:
ArjenR49 wrote:
You can also copy-paste the dhcp-host lines from a text file into the additional options field and do away with the thumbdrive.
OK I like this approach to the issue at hand, but does it actually need a USB flash drive to work?
I have quite a few of them but I don't want to tie up one just for this purpose.
I will if I absolutely need to though. The smallest (capacity not physical size) is 4GB so that should be enough for those files
Getting a USB thumbdrive to mount and make it accessible through SMB to other clients, plus making DD-WRT use the JFFS partition on the thumbdrive for storage of leases requires extra work, which may not be immediately obvious and maybe requires trial and error.
Like I wrote, you can copy your dhcp-host options from a text file you type up and paste the lines into the additional dnsmasq options field.
You can edit them in the options field and copy the lines from there back to your (backup) text file, when you're satisfied with the settings.
I would say this is the easiest way out of re-entering everything after a reset to defaults.
There may be some limit on the length of the additional options field. Always be prepared for snags like that.
Of course, all the dhcp-host options will also be in the backup created in the Administration, Backup/Restore page.
OK I just looked at my DHCP static lease table I was wrong about 25 I only 16 of them in use.
Anyway is there a certain format that I have to enter them in the "Additional DHCPd Options" box?
Sorry if I seem dense on this subject coding is not my thing. After I figure this problem out it is on to getting guest networks working (one for each radio band with internet access only and no network access)
An easy thing for you might be to go in to the router's CLI and type:
Code:
cat /tmp/dnsmasq.conf
You'll see a list of all of DNSMasq's settings, including the current static leases you've defined. Just copy those lines into a text document so you'll have it.
An easy thing for you might be to go in to the router's CLI and type:
Code:
cat /tmp/dnsmasq.conf
You'll see a list of all of DNSMasq's settings, including the current static leases you've defined. Just copy those lines into a text document so you'll have it.
Thanks,
I wish I asked this question way sooner then I did that was very easy even for a manual code entering dunce like me!. I now have an easy way to back up and edit the static DHCP lease table.
For reference that
"cat /tmp/dnsmasq.conf" is entered without quotes and is to be entered in the "Administration" tab under the "Commands" sub tab.
enter it in the box and then click "Run Commands"
The output will be all of your static DHCP leases and all of your DHCPd and DNSMasq options.
Now on to figuring out how to make guest networks (one for each radio band and no network access only internet access)
Joined: 05 Oct 2008 Posts: 666 Location: Helsinki, Finland / nr. Alkmaar, Netherlands
Posted: Sat May 16, 2020 7:25 Post subject: Re: Thank You all I figured it out and I got it working!
Format_C wrote:
Now on to figuring out how to make guest networks (one for each radio band and no network access only internet access)
Bear in mind that I use an external DNS server (a Raspberry PI with PI-HOLE and PI-VPN on the main LAN), so my description will not apply literally in every aspect.
First set up a virtual wireless LAN (VLAN), then do the password stuff for it and reboot.
In the Wireless settings set AP isolation.
The rest is done in Setup Networking.
You'll need to 'create bridge' br1 for your first VLAN.
Leave the network configuration (for ath0.1) at its defaults. Especially do not use unbridged. The wiki warns against it and even though it may be old, it seems to be good advice; I had my share of problems when I tried without explicitly setting up a bridge for the VLAN.
Set your desired network address and mask at 'Network Configuration br1' for the newly defined bridge br1. E.g. 192.168.10.1 and 255.255.255.248 for a small VLAN with max. 5 clients in addition to the network address itself.
Next set a DHCP server for the new bridge br1 at the bottom of this page.
Start value 2 and max 5 (-> client's IP will be from 192.168.10.2 to 192.168.10.6).
Then do the 'Assign to bridge' thing for br1 and your new VLAN (e.g. ath0.1) near the top of the page. The Current Bridging Table will reflect the change.
You will have to apply values or reboot at different points to make new options and values show up.
Now check if DNS settings in the GUI and on connected clients are as expected.
In my case I have no DNS settings in Basic settings (all 0.0.0.0) but in Additional DNSMasq options there is a no-resolv option and a server= line advertising the address of my PI-HOLE DNS server to all clients (of both main LAN and WLAN as well as the VLAN).
There is an option for Net Isolation in the 'Network Configuration br1', but I left it disabled for now.
You could experiment with it and check the results from connected clients. The AP isolation may suffice.
IPv6 may not work on the VLAN.
In my case it doesn't whereas on the main LAN/WLAN both IPv6 and DNSSEC work a treat (according to relevant tests). DNSSEC also works on my VLAN's.
I hope this gets you started.
Last edited by ArjenR49 on Sun May 17, 2020 16:53; edited 1 time in total
Joined: 18 Mar 2014 Posts: 12913 Location: Netherlands
Posted: Sat May 16, 2020 7:44 Post subject:
@ArjenR49 and @Format_C you are starting a a new and totally unrelated subject which should be discussed in a separate thread in the Advanced networking forum.
So that we can all learn and search these things back