What's new

Feature Request: Mass upload of DHCP hostnames from the GUI

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

BugsXor

Occasional Visitor
Hi Everyone,

Not sure how to request new feature for the awesome ASUSWRT from Merlin, so before sending him directly an email I thought I would post something here... especially if what I am about to ask is already possible! :)

I am using reserved DHCP IP addresses to assign specific IP addresses to all my network hosts. This is a great way to centrally maintain a full list of IP/hostname from the ASUS router.
The problem is thus far the only way I found to set this up is to manually add each IP/MAC/Hostname entry one by one. Even more cumbersome, is the fact each of the 3 column has to be entered separately.
It does work, but when you have 50 or 100 hosts, this process is quite time consuming.

Other routers OS have an option to bulk upload a list of pre-formatted IP/MAC/Hostname and it makes this process so much easier/quicker.

I was wondering/hoping/praying for this feature to be added to the ASUSWRT build, this would be really useful when we have to do factory reset when upgrading to some major new release or troubleshooting other issues.

I think there is probably a way to run a script in nvram/JFFS but a GUI CSV upload option would be a very nice touch and probably safer! (you may want an export option too, but that might be already asking too much :)

What do you guys think? is that already possible? would it be a nice feature? What is the best way to get this to Merlin's attention?

Thanks.
B.
 
No intention of adding this, as adding new features is not a priority, and this would target more the business market anyway - my focus is on the home market.
 
Hi Everyone,

Not sure how to request new feature for the awesome ASUSWRT from Merlin, so before sending him directly an email I thought I would post something here... especially if what I am about to ask is already possible! :)

I am using reserved DHCP IP addresses to assign specific IP addresses to all my network hosts. This is a great way to centrally maintain a full list of IP/hostname from the ASUS router.
The problem is thus far the only way I found to set this up is to manually add each IP/MAC/Hostname entry one by one. Even more cumbersome, is the fact each of the 3 column has to be entered separately.
It does work, but when you have 50 or 100 hosts, this process is quite time consuming.

Other routers OS have an option to bulk upload a list of pre-formatted IP/MAC/Hostname and it makes this process so much easier/quicker.

I was wondering/hoping/praying for this feature to be added to the ASUSWRT build, this would be really useful when we have to do factory reset when upgrading to some major new release or troubleshooting other issues.

I think there is probably a way to run a script in nvram/JFFS but a GUI CSV upload option would be a very nice touch and probably safer! (you may want an export option too, but that might be already asking too much :)

What do you guys think? is that already possible? would it be a nice feature? What is the best way to get this to Merlin's attention?

Thanks.
B.


Given RMerlin's reply you will need a script... add your 100 hosts grouped as you wish either in I/P address order or just alphabetical name order

Code:
#!/bin/sh

#  Refresh a sorted list of the DHCP STATIC table

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

nvram set dhcp_staticlist="<xx:xx:xx:xx:xx:xx>10.9.8.1>TL-SG2008-Loc1\
<xx:xx:xx:xx:xx:xx>10.9.8.2>TL-SG2008-Loc2\

  repeat necessary devices statements here or even write a 'for loop' to generate the 100 individual I/P address lines?

<xx:xx:xx:xx:xx:xx>10.9.8.x>DIR-855"


nvram set dhcp_static_x="1"
 
Last edited:
No intention of adding this, as adding new features is not a priority, and this would target more the business market anyway - my focus is on the home market.

Thanks for the quick answer, and fair enough!
Although this is not necessarily for the business market, this would actually be useful for a medium size home network. Even with just 20 devices that would be useful and make a factory reset less painful. You very quickly reach that number (and beyond!) when you start adding home automation devices and various connected health gadget.
I guess it is a different view on how to manage you home network IP from Static Vs Reserved DHCP. I found the DHCP route more flexible and the need to know which devices belong to which IP is because I am running some IDS/Network profiling engine on my home network. Sure, if you don't run such tools you might not care what IP each device get allocated. As there was a nice GUI already built in to add DHCP reservation and hostname it could have been a nice addition... but I understand you probably have many more other priorities with your custom build!

I will use a script but thought I would ask anyway :)
Thanks for the great work you are doing!
B.
 
Given RMerlin's reply you will need a script... add your 100 hosts grouped as you wish either in I/P address order or just alphabetical name order

Code:
#!/bin/sh

#  Refresh a sorted list of the DHCP STATIC table

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

nvram set dhcp_staticlist="<xx:xx:xx:xx:xx:xx>10.9.8.1>TL-SG2008-Loc1\
<xx:xx:xx:xx:xx:xx>10.9.8.2>TL-SG2008-Loc2\

  repeat necessary devices statements here or even write a 'for loop' to generate the 100 individual I/P address lines?

<xx:xx:xx:xx:xx:xx>10.9.8.x>DIR-855\"


nvram set dhcp_static_x="1"

Thanks for the script, I guess this is something I will need to run everytime the router reboots? or just once?
There is probably an RTFM somewhere on that topic ;)
 
Thanks for the script, I guess this is something I will need to run everytime the router reboots? or just once?
There is probably an RTFM somewhere on that topic ;)


No just run once ( the NVRAM variable is persistent across reboots) then when the time comes to upgrade the firmware or you opt for a factory default reset, then run John's excellent NVRAM Save-Restore utility before you upgrade/reset to make the restore less painful! to reinstate your customised NVRAM variables.
 
No just run once ( the NVRAM variable is persistent across reboots) then when the time comes to upgrade the firmware or you opt for a factory default reset, then run John's excellent NVRAM Save-Restore utility before you upgrade/reset to restore all the router's NVRAM variables.
Thanks, will look into that script!
 
No intention of adding this, ... this would target more the business market anyway - my focus is on the home market.
this would actually be useful for a medium size home network.
B.
With all deference to Merlin, I consider that a I/We have a "small" home network (just myself & the wife), a PC, a Laptop, a "Home Server", a NAS, a printer, two (Android) mobiles, an (Android tablet), a couple of "Smart" Televisions, and toss-in a few HomePlug WiFi devices, a few Hyper-V VM's etc, a ChromeCast, and two Amazon Fire TV Sticks ...

Also, given that most of these devices have both wired & wireless MAC addresses ...
- that all adds-up to a big PITA when they have to be re-in-putted

I will have a look at this NVRAM method, but IMHO (although excellently explained), this is not a simple "Home User" task for those more used to a GUI

Please can you re-consider ?
 
With all deference to Merlin, I consider that a I/We have a "small" home network (just myself & the wife), a PC, a Laptop, a "Home Server", a NAS, a printer, two (Android) mobiles, an (Android tablet), a couple of "Smart" Televisions, and toss-in a few HomePlug WiFi devices, a few Hyper-V VM's etc, a ChromeCast, and two Amazon Fire TV Sticks ...

Also, given that most of these devices have both wired & wireless MAC addresses ...
- that all adds-up to a big PITA when they have to be re-in-putted

I will have a look at this NVRAM method, but IMHO (although excellently explained), this is not a simple "Home User" task for those more used to a GUI

Please can you re-consider ?

Unless cut'n'paste is truly beyond your skills then adding the necessary lines to the 'template' script I originally posted shouldn't be too taxing.

RMerlin's aim is to allow the capabilities of the router to be enhanced by the use of custom scripts, whilst focusing on stability/performance rather than GUI 'bloat'.

https://github.com/RMerl/asuswrt-merlin/wiki

and by far the most useful script is John9527's NVRAM Save/restore script (see post #4) which removes the tedium of restoring a custom configuration.

So a quick modification to my original post; the following script will import the DHCP reserved list from a .CSV file....


Code:
#!/bin/sh

logger -s -t "($(basename $0))" Reserved DHCP table being reset.....

VAR=""
while IFS="," read MACID IPADDR DESC
do
    VAR=$VAR"<"$MACID">"$IPADDR">"$DESC
done < ReservedDHCP.csv

nvram set dhcp_staticlist="$VAR"

nvram set dhcp_static_x="1"
nvram commit

logger -s -t "($(basename $0))" Reserved DHCP table reset $VAR
 
Please can you re-consider ?

As Martineau pointed out, I want to avoid filling the webui with a ton of cryptic features many of which randomly breaks whenever I merge new code from Asus, confuse the average home user (a common complain about OpenWRT and DD-WRT), and are only used by 0.5% of the userbase anyway.

BTW, note that dnsmasq tends to already assign the same IPs to each devices most of the time. IPs are assigned based on some hashing mechanism based on the MAC, so most of the time you don't even need to define a reservation.

The very rare cases where someone would actually need for some reason to define so many reservations, the scripted method is the best way.
 
As I said, I will have a go at doing it the NVRAM way

A couple of questions though ...
... grouped as you wish either in I/P address order or just alphabetical name order

Does the CSV file really have to be in order, or is that just for readability ?
Does the "$DESC" have to be unique ? eg. for devices with multiple MACs
Do I have to re-load the whole NVRAM list/table from CSV every time I want to make an alteration, or can I try-out alterations via the GUI ? (and then export the updated list/table to CSV)
 
As I said, I will have a go at doing it the NVRAM way

A couple of questions though ...


Does the CSV file really have to be in order, or is that just for readability ?
Does the "$DESC" have to be unique ? eg. for devices with multiple MACs
Do I have to re-load the whole NVRAM list/table from CSV every time I want to make an alteration, or can I try-out alterations via the GUI ? (and then export the updated list/table to CSV)

The order of the entries in the GUI doesn't matter...but sometimes when adding a new MAC it is easier if the entries are in ascending IP address order - simply so you can visually check!

The DHCP name ($DESC) should be unique otherwise how would a PING command target the correct I/P address?

I think you can add an entry to /jffs/configs/dnsmasq.conf.add to assign a single reserved IP address to a device with both Wifi and LAN access (although usually only one interface is active at a time).

Code:
# Laptop WiFi or LAN adapter

dhcp-host=xx:xx:xx:xx:xx:xx,yy:yy:yy:yy:yy:yy,Laptop,192.168.1.nnn

You can export the NVRAM variable manually (although not as a .CSV list without another script) having modified the list via the GUI.
 
I think you can add an entry to /jffs/configs/dnsmasq.conf.add to assign a single reserved IP address to a device with both Wifi and LAN access (although usually only one interface is active at a time).
Actually, you need to make sure only one interface is active, otherwise dnsmasq doesn't know what to do and the results are unpredictable. I tried experimenting with it for a while and gave up....went to separate entries and a script on the PC to manually switch interfaces.
 
Hi.

Sorry to re-activate an old thread, but can this method of using dnsmasq be used to assign an IP to a broadcast MAC?

In DD-WRT / pfsense, I assigned 192.168.1.253 to ff:ff:ff:ff:ff:ff so wake on wan would work from a smartphone. Asus firmware cannot handle the mac address and says it's invalid, so im trying to find another way of doing it.

I then NAT port 9 to 192.168.1.253 so that the smartphone app can wake up my server.
 
I tried the following to successfully add a broadcast address to the GUI, but it does not seem to work even if it got added without error:

nvram set dhcp_staticlist="<ff:ff:ff:ff:ff:ff>192.168.1.253>wol-host"
nvram commit

After typing in these commands the mapping shows up in the GUI.
 
I know this is an old thread but since I gave the script a try it's good to let you know that it only loaded MACID and IPADDR. DESC field was all blank. Any ideas why?

CSV file sample:
.
.
.
58:6D:8F:xx:xx:xx,10.0.0.2,LinksysE4200-e2
78:CA:39:aa:bb:cc,10.0.0.3,TCapsule-e3
8C:45:00:11:22:33,10.0.0.4,SmartPhone-w4
.
.
.

Screenshot after updating DESC manually:

https://imgur.com/a/H5zhyLa

Unless cut'n'paste is truly beyond your skills then adding the necessary lines to the 'template' script I originally posted shouldn't be too taxing.

RMerlin's aim is to allow the capabilities of the router to be enhanced by the use of custom scripts, whilst focusing on stability/performance rather than GUI 'bloat'.

https://github.com/RMerl/asuswrt-merlin/wiki

and by far the most useful script is John9527's NVRAM Save/restore script (see post #4) which removes the tedium of restoring a custom configuration.

So a quick modification to my original post; the following script will import the DHCP reserved list from a .CSV file....


Code:
#!/bin/sh

logger -s -t "($(basename $0))" Reserved DHCP table being reset.....

VAR=""
while IFS="," read MACID IPADDR DESC
do
    VAR=$VAR"<"$MACID">"$IPADDR">"$DESC
done < ReservedDHCP.csv

nvram set dhcp_staticlist="$VAR"

nvram set dhcp_static_x="1"
nvram commit

logger -s -t "($(basename $0))" Reserved DHCP table reset $VAR
 
Last edited:
What firmware version are you using? The format of the NVRAM variable was changed in 384.13 (see the release notes).
 

Sign Up For SNBForums Daily Digest

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

Members online

Top