What's new

Set manual IPs via nvram (dhcp_staticlist)

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

xantiux

Occasional Visitor
I'm trying to set the static IPs on nvram set dhcp_staticlist via a file.

I can set them fine if I pass a long string via the command, like the example below:
Code:
nvram set dhcp_staticlist="<MAC:1>192.168.3.111>Unit1><MAC:2>192.168.3.112>Unit2><MAC:3>192.168.3.113>Unit3>"

I am unable to get this to work by passing a file instead of the string. The command I'm using is:
Code:
nvram set dhcp_staticlist=/tmp/file.txt
The file contains one long string:
Code:
<MAC:1>192.168.3.111>Unit1><MAC:2>192.168.3.112>Unit2><MAC:3>192.168.3.113>Unit3>

When I run the command above, the static IP list is cleared, and it's empty.
What am I doing wrong?
 
Last edited:
You can't "pass" anything to it. It's a variable so you can only assign a string of characters.
Code:
nvram set dhcp_staticlist="$(cat /tmp/file.txt)"
 
Is it possible to work around the nvram command length limitation by somehow adding new entries to the existing ones?
Or is there no easy way to append entries to the existing list?
 
It doesn't matter what technique you use the maximum length of that string in Merlin's current firmware is 2999 characters.
 
If you really need more entries you'd have to start putting them in a dnsmasq.conf.add file as noted here.
 
That did it!
Thank you good sir!

I found that both the NVRAM settings are required to complete the picture :):
  • dhcp_staticlist (MAC Address to IP Address) and
  • custom_clientlist (MAC Address to Client Name)
 
I found that both the NVRAM settings are required to complete the picture :):
  • dhcp_staticlist (MAC Address to IP Address) and
  • custom_clientlist (MAC Address to Client Name)
Is there any way to combine this so you can do the lot in one go?
 

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