What's new

Alternative ways to backup MAC-to-IP setting

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

leon

Regular Contributor
Hello,

I like to do a factory reset, and reconfigure my router. I don't mind re-do all except the setting unde LAN where I assign IP based on the MAC address. Is there a way for me just to backup these data?

Thanks in advance!
 
Would this work for you?


 
See this script: https://www.snbforums.com/threads/dhcp_staticlist-and-dhcp_hostnames-utility.58957/

Or another option is to run this command to create the necessary commands to reapply the settings:
Bash:
printf "nvram set dhcp_staticlist=\"%s\"\nnvram set dhcp_hostnames=\"%s\"\nnvram commit\nservice restart_net_and_phy\n" "$(nvram get dhcp_staticlist)" "$(nvram get dhcp_hostnames)"

The idea is you would save the 4 lines this command creates, and paste them back into the SSH window after the reset. It will restart your network so the devices will disconnect and fetch the manual IP assignments.
 
See this script: https://www.snbforums.com/threads/dhcp_staticlist-and-dhcp_hostnames-utility.58957/

Or another option is to run this command to create the necessary commands to reapply the settings:
Bash:
printf "nvram set dhcp_staticlist=\"%s\"\nnvram set dhcp_hostnames=\"%s\"\nnvram commit\nservice restart_net_and_phy\n" "$(nvram get dhcp_staticlist)" "$(nvram get dhcp_hostnames)"

The idea is you would save the 4 lines this command creates, and paste them back into the SSH window after the reset. It will restart your network so the devices will disconnect and fetch the manual IP assignments.
Dang, forgot about this one created by @Xentrk
 
I've done this a few times recently and it's pretty painless.

Run "nvram show | sort" and copy all of this into a text file for reference later (might need to extend scrollback settings of your SSH client). The stuff you want is on the dhcp_staticlist line.

After reset, enable SSH and run the below;
nvram set dhcp_staticlist="<00:68:XX:XX:XX:XX>192.168.1.209><84:C5:XX:XX:XX:XX>192.168.1.200><80:32:XX:XX:XX:XX>192.168.1.201>"
nvram commit
reboot

I rebooted to clear the DHCP leases and force clients to pick up their reservation at the end, but there's probably a more elegant way to do it...
 
The save-mynvram.sh script that is part of the NVRAM Save/Restore Utility can also be used and provides the ability to specify other nvarm parms

save-mynvram.sh is a small script that can save/restore a small number of user specified nvram settings. Pass the nvram values you want to save to the script as parameters (e.g. dhcp_hostnames and dhcp_staticlist). This will create a script called restore-mynvram.sh. Run restore-mynvram.sh to restore the nvram parameters. If a previous restore-mynvram.sh restore file exists, a backup file will be created.

Code:
sh save-mynvram.sh dhcp_hostnames dhcp_staticlist

Saving dhcp_hostnames
Saving dhcp_staticlist
Backing up previous restore script to /tmp/mnt/AC88U/nsru/restore-mynvram.sh.bak

Saved 2 NVRAM variable(s)
Run /tmp/mnt/AC88U/nsru/restore-mynvram.sh to restore your saved settings
 

Similar threads

Sign Up For SNBForums Daily Digest

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