dhcp_staticlist and dhcp_hostnames utility

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

Xentrk

Part of the Furniture
dhcpstaticlist.sh is a helpful utility script to manage DHCP static leases. The script is only compatible with 384.13 release. The script displays a menu with the following functions:
  1. Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp. This will allow you to restore the values after performing a factory reset.

  2. Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/.

  3. Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format.

  4. Append Output DHCP Static List to /jffs/configs/dnsmasq.conf.add & Disable Manual Assignment in the WAN GUI. You will then be prompted to reboot the router to have the settings take effect.

  5. Disable DHCP Manual Assignment.

  6. Enable DHCP Manual Assignment.

  7. Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values.

  8. Display character size of dhcp_staticlist and dhcp_hostnames.
If you don't have entware installed, you can edit the script and change the /opt/tmp references to /jffs/scripts or whatever directory you want to use.

Installation
Code:
/usr/sbin/curl --retry 3 "https://raw.githubusercontent.com/Xentrk/Asuswrt-Merlin-Linux-Shell-Scripts/master/dhcpstaticlist.sh" -o "/jffs/scripts/dhcpstaticlist.sh" && chmod 755 /jffs/scripts/dhcpstaticlist.sh && sh /jffs/scripts/dhcpstaticlist.sh
Menu
Code:
Use this utility to save or restore dhcp_staticlist and dhcp_hostnames nvram values

[1] - Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/
[2] - Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/
[3] - Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format
[4] - Append dhcp_staticlist and dhcp_hostnames to dnsmasq.conf.add & Disable DHCP Manual Assignment
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
[8] - Display character size of dhcp_staticlist and dhcp_hostnames (2999 is the limit)
[e] - Exit

==>
Documentation on the script and other utilities I wrote are available at:
https://github.com/Xentrk/Asuswrt-Merlin-Linux-Shell-Scripts
 
Last edited:

Xentrk

Part of the Furniture
I had to make updates to the code to accommodate HND routers RT-AC86U and RT-AX88U. Please download the new version using the instructions above.
 

Kingp1n

Very Senior Member
Will definitely try it out...thanks @ Xentrk
 

elorimer

Very Senior Member
For previewing (#3):
Code:
==> 3
Unexpected error condition dhcp_staticlist and dhcp_hostnames don't match
[: bad number
[: bad number
Press enter to continue
I can see there are about 3 entries in the hostnames files and scores of entries in staticlist
 

Xentrk

Part of the Furniture
For previewing (#3):
Code:
==> 3
Unexpected error condition dhcp_staticlist and dhcp_hostnames don't match
[: bad number
[: bad number
Press enter to continue
I can see there are about 3 entries in the hostnames files and scores of entries in staticlist
There must be an entry in dhcp_hostnames I am not accounting for.

The first version of the script expected the format of
Code:
<mac address>hostname<mac address>hostname
I then had to modify to look for the word "undefined" based on feedback from an RT-AC86U user:
Code:
<mac address>hostname>undefined<mac address>hostname
Please run the command below and let me know if you spot any values not in the order listed above. This will list the content of nvram and strip out the "<", ">" and "undefined" and replace them with a space:

Code:
nvram get dhcp_hostnames | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
Code:
nvram get dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
 
Last edited:

jsbeddow

Senior Member
BTW, I can confirm that I get the same error as elorimer for #3 (preview function). This is on my 86U, if that helps.

EDIT: I tried running the two suggested commands above, the first one returns nothing (blank line). The second one returns the expected IPs and MAC addresses, in order (no issue spotted there).
 
Last edited:

Xentrk

Part of the Furniture
BTW, I can confirm that I get the same error as elorimer for #3 (preview function). This is on my 86U, if that helps.

EDIT: I tried running the two suggested commands above, the first one returns nothing (blank line). The second one returns the expected IPs and MAC addresses, in order (no issue spotted there).
It is different commands for the 86U. You can run this instead.
Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
 

Xentrk

Part of the Furniture
BTW, I can confirm that I get the same error as elorimer for #3 (preview function). This is on my 86U, if that helps.

EDIT: I tried running the two suggested commands above, the first one returns nothing (blank line). The second one returns the expected IPs and MAC addresses, in order (no issue spotted there).
It is different commands for the 86U. You can run this instead.
Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
 

Olivier

Occasional Visitor
Hello,

Herewith my outputs because I'm struggling with the same issue with an AX88U.
Code:
==> 3

Unexpected error condition dhcp_staticlist and dhcp_hostnames don't match
[: bad number
[: bad number

Press enter to continue
Code:
[email protected]:/jffs/scripts# nvram get dhcp_hostnames | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'

BLANK
Code:
[email protected]:/jffs/scripts# nvram get dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
0C:9D:92:50:89:30 192.168.50.2 0C:9D:92:52:E4:30 192.168.50.3 E0:3F:49:ED:EE:58 192.168.50.4 18:B4:30:98:B1:FA 192.168.50.10 18:B4:30:DA:79:7A 192.168.50.11 18:B4:30:6A:9B:62 192.168.50.12 18:B4:30:65:F5:4A 192.168.50.13 00:30:56:A4:50:86 192.168.50.14 00:17:88:28:0F:37 192.168.50.16 D8:80:39:89:03:93 192.168.50.17 B8:74:24:0A:9E:26 192.168.50.19 00:24:E4:0D:5D:46 192.168.50.20 F4:39:09:65:17:1D 192.168.50.21 00:11:32:9D:8A:50 192.168.50.22 B8:27:EB:F2:34:DB 192.168.50.31 C8:D0:83:B8:A3:56 192.168.50.33 40:CB:C0:D3:66:EA 192.168.50.35 EC:E5:12:13:39:F9 192.168.50.36 D4:A3:3D:84:16:AC 192.168.50.40 D4:A3:3D:73:52:EF 192.168.50.41 8C:85:90:39:D9:FB 192.168.50.50 18:65:90:9A:DB:6A 192.168.50.52 D8:CB:8A:A2:F5:8B 192.168.50.60 7C:8B:CA:1C:0A:AD 192.168.50.61 A0:99:9B:C2:9C:E1 192.168.50.62 00:B3:62:47:D1:90 192.168.50.63 D8:CB:8A:AA:A9:59 192.168.50.70 undefined 6C:8D:C1:BA:9E:75 192.168.50.72 88:E9:FE:87:69:E4 192.168.50.80 90:8D:6C:28:0E:F7 192.168.50.82 D8:1C:79:D1:2B:B8 192.168.50.83 08:F4:AB:9B:10:F5 192.168.50.84 B0:FC:0D:F6:BC:D4 192.168.50.85
Code:
[email protected]:/jffs/scripts# awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/
>/ /g;s/</ /g'
0C:9D:92:50:89:30 192.168.50.2 0C:9D:92:52:E4:30 192.168.50.3 E0:3F:49:ED:EE:58 192.168.50.4 18:B4:30:98:B1:FA 192.168.50.10 18:B4:30:DA:79:7A 192.168.50.11 18:B4:30:6A:9B:62 192.168.50.12 18:B4:30:65:F5:4A 192.168.50.13 00:30:56:A4:50:86 192.168.50.14 00:17:88:28:0F:37 192.168.50.16 D8:80:39:89:03:93 192.168.50.17 B8:74:24:0A:9E:26 192.168.50.19 00:24:E4:0D:5D:46 192.168.50.20 F4:39:09:65:17:1D 192.168.50.21 00:11:32:9D:8A:50 192.168.50.22 B8:27:EB:F2:34:DB 192.168.50.31 C8:D0:83:B8:A3:56 192.168.50.33 40:CB:C0:D3:66:EA 192.168.50.35 EC:E5:12:13:39:F9 192.168.50.36 D4:A3:3D:84:16:AC 192.168.50.40 D4:A3:3D:73:52:EF 192.168.50.41 8C:85:90:39:D9:FB 192.168.50.50 18:65:90:9A:DB:6A 192.168.50.52 D8:CB:8A:A2:F5:8B 192.168.50.60 7C:8B:CA:1C:0A:AD 192.168.50.61 A0:99:9B:C2:9C:E1 192.168.50.62 00:B3:62:47:D1:90 192.168.50.63 D8:CB:8A:AA:A9:59 192.168.50.70 undefined 6C:8D:C1:BA:9E:75 192.168.50.72 88:E9:FE:87:69:E4 192.168.50.80 90:8D:6C:28:0E:F7 192.168.50.82 D8:1C:79:D1:2B:B8 192.168.50.83 08:F4:AB:9B:10:F5 192.168.50.84 B0:FC:0D:F6:BC:D4 192.168.50.85
Thanks.
 

Jack Yaz

Part of the Furniture
You seem to reference a variable that is only set for exception conditions:

Code:
if [ "$word_count_staticlist" -ne "$word_count_hostnames" ]; then
echo "Unexpected error condition dhcp_staticlist and dhcp_hostnames don't match"
else
# count number of static leases. This is the number of loops required to get IP address and client name
# divide word_count by 2 since client information is listed in groups of 2 fields: MAC_Address and IP_Address
static_leases_count=$((word_count_staticlist / 2))
fi

while [ "$loop_count" -le "$static_leases_count" ]; do
 

HardCat

Regular Contributor
There is also an "undefined" in the output @Olivier provided which should have been removed with the one liner awk and sed statement @Xentrk provided.

When I tested, the "undefined" was the problem, once removed the script worked fine.
 

Butterfly Bones

Very Senior Member
It is different commands for the 86U. You can run this instead.
Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'
Does this show anything or help? AC86U with 384.13
Code:
@RT-AC86U-4608:/tmp/home/root# awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/>/ /g;s/</ /g'

50:9A:4C:3A:6B:4A 192.168.1.5 44:80:EB:AE:83:97 192.168.1.6 D8:50:E6:34:1B:DA 192.168.1.7 24:1F:A0:CE:07:67 192.168.1.8 DC:0B:34:B9:D4:15 192.168.1.9 28:C6:3F:33:7F:E3 192.168.1.10 74:C2:46:81:2C:76 192.168.1.11 B4:F1:DA:EC:0A:7E 192.168.1.12 FC:2A:9C:AF:C7:9C 192.168.1.14 68:FE:F7:3E:68:8F 192.168.1.15 98:46:0A:35:8F:8F 192.168.1.16 30:05:5C:56:40:2E 192.168.1.40 44:09:B8:40:BC:27 192.168.1.51 A0:6A:44:07:E9:58 192.168.1.62 A0:6A:44:02:06:62 192.168.1.63 E6:F0:42:23:8E:80 192.168.1.101 22:DF:B9:77:16:CC 192.168.1.102 20:DF:B9:9D:C4:AF 192.168.1.105 E4:F0:42:5D:0A:11 192.168.1.106 E4:F0:42:38:84:D4 192.168.1.107 50:C7:BF:FB:28:87 192.168.1.120 50:C7:BF:FB:11:9D 192.168.1.121 50:C7:BF:5E:65:39 192.168.1.122 00:24:E4:6D:1F:4C 192.168.1.150 38:F9:D3:DC:0F:1C 192.168.1.17
 

Xentrk

Part of the Furniture
Hello,


Code:
[email protected]:/jffs/scripts# awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/>undefined//;s/
>/ /g;s/</ /g'
0C:9D:92:50:89:30 192.168.50.2 0C:9D:92:52:E4:30 192.168.50.3 E0:3F:49:ED:EE:58 192.168.50.4 18:B4:30:98:B1:FA 192.168.50.10 18:B4:30:DA:79:7A 192.168.50.11 18:B4:30:6A:9B:62 192.168.50.12 18:B4:30:65:F5:4A 192.168.50.13 00:30:56:A4:50:86 192.168.50.14 00:17:88:28:0F:37 192.168.50.16 D8:80:39:89:03:93 192.168.50.17 B8:74:24:0A:9E:26 192.168.50.19 00:24:E4:0D:5D:46 192.168.50.20 F4:39:09:65:17:1D 192.168.50.21 00:11:32:9D:8A:50 192.168.50.22 B8:27:EB:F2:34:DB 192.168.50.31 C8:D0:83:B8:A3:56 192.168.50.33 40:CB:C0:D3:66:EA 192.168.50.35 EC:E5:12:13:39:F9 192.168.50.36 D4:A3:3D:84:16:AC 192.168.50.40 D4:A3:3D:73:52:EF 192.168.50.41 8C:85:90:39:D9:FB 192.168.50.50 18:65:90:9A:DB:6A 192.168.50.52 D8:CB:8A:A2:F5:8B 192.168.50.60 7C:8B:CA:1C:0A:AD 192.168.50.61 A0:99:9B:C2:9C:E1 192.168.50.62 00:B3:62:47:D1:90 192.168.50.63 D8:CB:8A:AA:A9:59 192.168.50.70 undefined 6C:8D:C1:BA:9E:75 192.168.50.72 88:E9:FE:87:69:E4 192.168.50.80 90:8D:6C:28:0E:F7 192.168.50.82 D8:1C:79:D1:2B:B8 192.168.50.83 08:F4:AB:9B:10:F5 192.168.50.84 B0:FC:0D:F6:BC:D4 192.168.50.85
Thanks.
Thanks for the information. Shouldn't be seeing the "undefined" in the output above for /jffs/nvram/dhcp_staticlist. The sed command is looking for ">undefined" and replacing it with a space if found.

Please run the command below and tell me if a "<" or ">" or another character is being used as a field separator between the IP address 192.168.50.70 and the word "undefined"
Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist
Note: I patched the [:bad number ] message and updated the error message. I kept processing if the error condition was reached rather than returning to the main menu.
 
Last edited:

Xentrk

Part of the Furniture
Does this show anything or help? AC86U with 384.13
The /jffs/nvram/dhcp_hostnames output looks okay to me. I don't see the "undefined" word which will cause a difference in word count between dhcp_staticlist and dhcp_hostnames if it's not removed.
 

Xentrk

Part of the Furniture
You seem to reference a variable that is only set for exception conditions:

Code:
if [ "$word_count_staticlist" -ne "$word_count_hostnames" ]; then
echo "Unexpected error condition dhcp_staticlist and dhcp_hostnames don't match"
else
# count number of static leases. This is the number of loops required to get IP address and client name
# divide word_count by 2 since client information is listed in groups of 2 fields: MAC_Address and IP_Address
static_leases_count=$((word_count_staticlist / 2))
fi

while [ "$loop_count" -le "$static_leases_count" ]; do
/jffs/nvram/dhcp_staticlist is in the format <mac>ip<mac>ip and so on

It may also contain the value "undefined": <mac>ip>undefined<mac>ip and so on

/jffs/nvram/dhcp_hostnames is in the format <mac>hostname<mac>hostname

So if I strip out the field separators and the word "undefined" and check that the word count of the two files match.

I patched the code to return to the menu if the error condition was reached. The bad number was a result of continuing to process the data even though there was a word count mismatch between dhcp_staticlist and dhcp_hostnames.

What I was surprised about is to see the nvram value dhcp_staticlist populated for HND routers. I thought HND were using /jffs/nvram/dhcp_staticlist instead. :confused: I'll have to research this. I thought the use of /jffs/nvram was to save nvram space. I'll need to update the code to also restore the nvram dhcp_staticlist in addition to the /jffs/nvram/dhcp_staticlist file for HND routers.

The output that @Olivier posted shows the "undefined" appearing in /jffs/nvram/dhcp_staticlist but not nvram value dhcp_staticlist.
 

Xentrk

Part of the Furniture
I removed the greater than sign field separator before the word "undefined" as the other two commands handle the "<" and ">" separators. So no matter if the field separator is a < or > sign, the function works.

Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist | sed 's/<//;s/undefined//;s/>/ /g;s/</ /g'
I pushed a new update to GitHub if you want to retest.
 

Olivier

Occasional Visitor
Thanks for the information. Shouldn't be seeing the "undefined" in the output above for /jffs/nvram/dhcp_staticlist. The sed command is looking for ">undefined" and replacing it with a space if found.

Please run the command below and tell me if a "<" or ">" or another character is being used as a field separator between the IP address 192.168.50.70 and the word "undefined"
Code:
awk '{print $0}' /jffs/nvram/dhcp_staticlist
Note: I patched the [:bad number ] message and updated the error message. I kept processing if the error condition was reached rather than returning to the main menu.
Hi @Xentrk ,

Herewith the output requested:
Code:
[email protected]:/tmp/home/root# awk '{print $0}' /jffs/nvram/dhcp_staticlist
<0C:9D:92:50:89:30>192.168.50.2<0C:9D:92:52:E4:30>192.168.50.3<E0:3F:49:ED:EE:58>192.168.50.4<18:B4:30:98:B1:FA>192.168.50.10<18:B4:30:DA:79:7A>192.168.50.11<18:B4:30:6A:9B:62>192.168.50.12<18:B4:30:65:F5:4A>192.168.50.13<00:30:56:A4:50:86>192.168.50.14<00:17:88:28:0F:37>192.168.50.16<D8:80:39:89:03:93>192.168.50.17<B8:74:24:0A:9E:26>192.168.50.19<00:24:E4:0D:5D:46>192.168.50.20<F4:39:09:65:17:1D>192.168.50.21<00:11:32:9D:8A:50>192.168.50.22<B8:27:EB:F2:34:DB>192.168.50.31<C8:D0:83:B8:A3:56>192.168.50.33<40:CB:C0:D3:66:EA>192.168.50.35<EC:E5:12:13:39:F9>192.168.50.36<D4:A3:3D:84:16:AC>192.168.50.40<D4:A3:3D:73:52:EF>192.168.50.41<8C:85:90:39:D9:FB>192.168.50.50<18:65:90:9A:DB:6A>192.168.50.52<D8:CB:8A:A2:F5:8B>192.168.50.60>undefined<7C:8B:CA:1C:0A:AD>192.168.50.61<A0:99:9B:C2:9C:E1>192.168.50.62>undefined<00:B3:62:47:D1:90>192.168.50.63<D8:CB:8A:AA:A9:59>192.168.50.70>undefined<6C:8D:C1:BA:9E:75>192.168.50.72<88:E9:FE:87:69:E4>192.168.50.80<90:8D:6C:28:0E:F7>192.168.50.82<D8:1C:79:D1:2B:B8>192.168.50.83<08:F4:AB:9B:10:F5>192.168.50.84<B0:FC:0D:F6:BC:D4>192.168.50.85
[email protected]:/tmp/home/root#
Also after updated your script, this is the output:
Code:
Use this utility to save or restore dhcp_staticlist and dhcp_hostnames nvram values

[1] - Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/
[2] - Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/
[3] - Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format
[4] - Append dhcp_staticlist and dhcp_hostnames to dnsmasq.conf.add & Disable DHCP Manual Assignment
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
[8] - Display character size of dhcp_staticlist and dhcp_hostnames (2999 is the limit)
[e] - Exit

==> 3

Error condition! dhcp_staticlist and dhcp_hostnames word count do not match

Press enter to continue
Cheers.
 

elorimer

Very Senior Member
Are you assuming that every manually assigned DHCP address has a hostname? Along the way that identity got broken, so I have about 50 or so DHCP assignments, but only a handful of hostnames remain. Perhaps that is why the error condition?

I have to figure out where I've ended up. Every entry in the Client List reached from the network map has a "Client Name", some of which were what I entered a long time ago as hostnames in the manual assignment list, and some of which are supplied in some other way. That Client Name also shows up in the manual assignment list if you click on the icon. But that is different from the Host Name, which for most of the entries in the manual table is blank.
 

Xentrk

Part of the Furniture
Are you assuming that every manually assigned DHCP address has a hostname? Along the way that identity got broken, so I have about 50 or so DHCP assignments, but only a handful of hostnames remain. Perhaps that is why the error condition?
You are correct. I did make that assumption that there will be an equivalent hostname for every dhcp static lease reservation. That explains why the word count check is failing. It appears that specifying the host names in the dhcp-host parameter in dnsmasq is optional. So I can probably remove the check to see if the word count matches between dhcp_staticlist and dhcp_hostnames.

--dhcp-host=[<hwaddr>][,id:<client_id>|*][,set:<tag>][,<ipaddr>][,<hostname>][,<lease_time>][,ignore]
Specify per host parameters for the DHCP server. This allows a machine with a particular hardware address to be always allocated the same hostname, IP address and lease time. A hostname specified like this overrides any supplied by the DHCP client on the machine. It is also allowable to omit the hardware address and include the hostname, in which case the IP address and lease times will apply to any machine claiming that name. For example --dhcp-host=00:20:e0:3b:13:af,wap,infinite tells dnsmasq to give the machine with hardware address 00:20:e0:3b:13:af the name wap, and an infinite DHCP lease. --dhcp-host=lap,192.168.0.199 tells dnsmasq to always allocate the machine lap the IP address 192.168.0.199.
 

Xentrk

Part of the Furniture
Hi @Xentrk ,

Herewith the output requested:
Code:
[email protected]:/tmp/home/root# awk '{print $0}' /jffs/nvram/dhcp_staticlist
<0C:9D:92:50:89:30>192.168.50.2<0C:9D:92:52:E4:30>192.168.50.3<E0:3F:49:ED:EE:58>192.168.50.4<18:B4:30:98:B1:FA>192.168.50.10<18:B4:30:DA:79:7A>192.168.50.11<18:B4:30:6A:9B:62>192.168.50.12<18:B4:30:65:F5:4A>192.168.50.13<00:30:56:A4:50:86>192.168.50.14<00:17:88:28:0F:37>192.168.50.16<D8:80:39:89:03:93>192.168.50.17<B8:74:24:0A:9E:26>192.168.50.19<00:24:E4:0D:5D:46>192.168.50.20<F4:39:09:65:17:1D>192.168.50.21<00:11:32:9D:8A:50>192.168.50.22<B8:27:EB:F2:34:DB>192.168.50.31<C8:D0:83:B8:A3:56>192.168.50.33<40:CB:C0:D3:66:EA>192.168.50.35<EC:E5:12:13:39:F9>192.168.50.36<D4:A3:3D:84:16:AC>192.168.50.40<D4:A3:3D:73:52:EF>192.168.50.41<8C:85:90:39:D9:FB>192.168.50.50<18:65:90:9A:DB:6A>192.168.50.52<D8:CB:8A:A2:F5:8B>192.168.50.60>undefined<7C:8B:CA:1C:0A:AD>192.168.50.61<A0:99:9B:C2:9C:E1>192.168.50.62>undefined<00:B3:62:47:D1:90>192.168.50.63<D8:CB:8A:AA:A9:59>192.168.50.70>undefined<6C:8D:C1:BA:9E:75>192.168.50.72<88:E9:FE:87:69:E4>192.168.50.80<90:8D:6C:28:0E:F7>192.168.50.82<D8:1C:79:D1:2B:B8>192.168.50.83<08:F4:AB:9B:10:F5>192.168.50.84<B0:FC:0D:F6:BC:D4>192.168.50.85
[email protected]:/tmp/home/root#
Also after updated your script, this is the output:
Code:
Use this utility to save or restore dhcp_staticlist and dhcp_hostnames nvram values

[1] - Save nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/
[2] - Restore nvram dhcp_staticlist and dhcp_hostnames from /opt/tmp/
[3] - Preview dhcp_staticlist and dhcp_hostnames in dnsmasq format
[4] - Append dhcp_staticlist and dhcp_hostnames to dnsmasq.conf.add & Disable DHCP Manual Assignment
[5] - Disable DHCP Manual Assignment
[6] - Enable DHCP Manual Assignment
[7] - Backup nvram dhcp_staticlist and dhcp_hostnames to /opt/tmp/ and clear nvram values
[8] - Display character size of dhcp_staticlist and dhcp_hostnames (2999 is the limit)
[e] - Exit

==> 3

Error condition! dhcp_staticlist and dhcp_hostnames word count do not match

Press enter to continue
Cheers.
Thank you! Appears the field separator is what I code for <mac>ip>undefined<mac>ip<mac>ip and so on...

I think @elorimer discovered the issue. Not all static IP reservations have an equivalent hostname! I now know where to focus to handle the condition.
 

Similar threads

Top