NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
SLK-Purdue
Mar 15, 2020Luminary
Script to load /etc/hosts, Static DHCP registrations, and Device name etc
I have developed a script to load /etc/hosts, set static DHCP reservations and update device name, and device type from a master excel spreadsheet. The script works well to create /etc/hosts and sets all the DHCP registrations. Items set are:
config set reservations[xx}
nvram set orbi_dev_name[xx]
nvram set orbi_dev_name_v2_ntgr[xx]
nvram set orbi_dev_name_ntgr[xx]
nvram set orbi_dev_type_ntgr[xx]
and then nvram commit and config commit. Finish with a reboot.
Updated device information is not showing on the web ui. If I edit the information on the web ui, nothing changes in nvram. Clearly, I am missing something.
The secret sauce appears to be in the net-cgi program that populated the device structure used in the web page display. (see DEV_show_device.htm and DEV_device_info.htm). Information is being saved somewhere else. Any ideas how to set the appropriate information in a script?
Thanks, Scott
9 Replies
Sort By
SLK-Purdue wrote:I have developed a script to load /etc/hosts, set static DHCP reservations and update device name, and device type from a master excel spreadsheet. The script works well to create /etc/hosts and sets all the DHCP registrations. Items set are:
config set reservations[xx}
nvram set orbi_dev_name[xx]
nvram set orbi_dev_name_v2_ntgr[xx]
nvram set orbi_dev_name_ntgr[xx]
nvram set orbi_dev_type_ntgr[xx]
and then nvram commit and config commit. Finish with a reboot.
Updated device information is not showing on the web ui. If I edit the information on the web ui, nothing changes in nvram. Clearly, I am missing something.
My practice was similar to yours except:
Everything was "config set". Nothing was "nvram set".
Reservation does not have an "s".
I opened the web page "Attached Devices", saw that everything was populated, and then clicked "Apply". Did not do a reboot.
- SLK-PurdueLuminary
You are corrrect on "reservations[xx}. My typo. My information didn't populate.Scott
SLK-Purdue wrote:I have developed a script to load /etc/hosts, set static DHCP reservations and update device name, and device type from a master excel spreadsheet. The script works well to create /etc/hosts and sets all the DHCP registrations. Items set are:
config set reservations[xx}
nvram set orbi_dev_name[xx]
nvram set orbi_dev_name_v2_ntgr[xx]
nvram set orbi_dev_name_ntgr[xx]
nvram set orbi_dev_type_ntgr[xx]
and then nvram commit and config commit. Finish with a reboot.
Updated device information is not showing on the web ui. If I edit the information on the web ui, nothing changes in nvram. Clearly, I am missing something.
My practice was similar to yours except:
Everything was "config set". Nothing was "nvram set".
Reservation does not have an "s".
I opened the web page "Attached Devices", saw that everything was populated, and then clicked "Apply". Did not do a reboot.
- SLK-PurdueLuminary
Just to clarify, Static DCHP reservations are populating and working fine. My problem is with the device name, model, and type.
- ekhalilMaster
Where do you change in the web ui and you don't see the changes on nvram? If I -for example- go to Attached Devices on the web ui and change the Device Name of a device I will see the changes directly on the parameter orbi_dev_namexx of that specific device.
It will be interesting if you can share the script that you are using.
SLK-Purdue wrote:......
Updated device information is not showing on the web ui. If I edit the information on the web ui, nothing changes in nvram. ......
- SLK-PurdueLuminary
Here is an example:
Telnet ooutput
root@Ksander-ORBI:/# nvram show | grep -i A4:D5:78:13:69:7C
reservation76=192.168.1.210 A4:D5:78:13:69:7C sense
orbi_dev_name_v2_ntgr76=A4:D5:78:13:69:7C 17 Sense
access_control25=0 A4:D5:78:13:69:7C 1 65523 SENSE-M725000917 0 0
orbi_dev_name_ntgr76=A4:D5:78:13:69:7C 26 Sense
orbi_dev_type_ntgr76=A4:D5:78:13:69:7C 1 1
orbi_dev_name76=A4:D5:78:13:69:7C SenseWeb Page shows:
IP Address 192.168.1.210
MAC Address A4:D5:78:13:69:7C
Device Model ---
Device Name SENSE-M725000917After I change Device Model and Name to Test Model and Test Name in web ui, nvram does change to
root@Ksander-ORBI:/# nvram show | grep -i A4:D5:78:13:69:7C
reservation76=192.168.1.210 A4:D5:78:13:69:7C sense
orbi_hid_mac=A4:D5:78:13:69:7C
orbi_dev_name_v2_ntgr76=A4:D5:78:13:69:7C 11 Test Model
access_control25=0 A4:D5:78:13:69:7C 1 24355 SENSE-M725000917 0 0
orbi_dev_type_ntgr76=A4:D5:78:13:69:7C 1 1
orbi_dev_name_ntgr76=A4:D5:78:13:69:7C 24 Test Model
orbi_dev_name76=A4:D5:78:13:69:7C Test Namebut the change is only 1 way (web ui to nvram). It I change nvram, commit, and/or reboot, the change is not reflected in the ui. Changed nvram back:
root@Ksander-ORBI:/# nvram show | grep -i A4:D5:78:13:69:7C
orbi_dev_name_v2_ntgr76=A4:D5:78:13:69:7C 17 Sense
access_control25=0 A4:D5:78:13:69:7C 1 24355 SENSE-M725000917 0 0
orbi_dev_type_ntgr76=A4:D5:78:13:69:7C 1 1
orbi_dev_name_ntgr76=A4:D5:78:13:69:7C 26 Sense
orbi_dev_name76=A4:D5:78:13:69:7C SenseWeb ui stays with Test Name
Having other issue with device type but let's solve one problem at a time.
If you are curious, Sense is a power line monitor. Cool device if you are into cool IoT things.
Thanks,
Scott
ps. happy to post the script if anyone interesting, Basically export master Excel file to cvs. Script run awk script on csv file. Output /etc/hosts and a command file with config set and nvram set. Finally edit dnsmasq.conf to read /etc/hosts, restarts dnsmasq and do the nvram and config commits.
- ekhalilMaster
After commit, you either need to go in the web ui to >> ADVANCED >> Setup >> LAN Setup and click on Apply, or you need to reboot the router for the changes to take effect.
SLK-Purdue wrote:............ It I change nvram, commit, and/or reboot, the change is not reflected in the ui. ........
............
Yes, I would love to see your script please. Thank you
SLK-Purdue wrote:.............
ps. happy to post the script if anyone interesting, Basically export master Excel file to cvs. Script run awk script on csv file. Output /etc/hosts and a command file with config set and nvram set. Finally edit dnsmasq.conf to read /etc/hosts, restarts dnsmasq and do the nvram and config commits.