What's new

Feature request: Sort dhcp list with ips or names

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

morpa

New Around Here
Feature request: Would it be possible to add a sort function to the column headers in dhcp list (Manually Assigned IP under LAN/DHCP Server)v for ip or name (ip-sort most wanted), and then be able to save the sorted list? I have a lot of devices assigned and sometimes I would like to rearrange ips, and being able to sort them neatly would make for an easier overview. As of now I would have to redo the whole list to get them in the order i want for overview.
 
Last edited:
To get a IP-sorted list (as a file: "dhcp_list_sorted_tmp.sh"). Run it in a script:

nvram get dhcp_staticlist | sed 's/</\n/g' | grep ":" | awk -F">" '{ print $2">"$1">"$3; }' | \sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n | awk -F">" '{ print $2">"$1">"$3; }' | \sed 's/^/</g' | tr -d '\n' | sed 's/^/nvram set dhcp_staticlist="/' | sed 's/$/"\n/' | tee dhcp_list_sorted_tmp.sh

(This file is good to keep as a backup if you need to clear nvram)

To flash that sorted list/file into router:

sh dhcp_list_sorted_tmp.sh
nvram commit


Make sure you run the scripts in a library where you have full read/write-access.
 
Hi, I very interested on this feature and just want confirm if the sorted list will be reachable from the web gui or I must get the file from the terminaal and ssh console.

Thanks
 
Should be standard part of the firmware. After sorting the nvram var the web interface shows the sorted list on page refresh.
 
To get a IP-sorted list (as a file: "dhcp_list_sorted_tmp.sh"). Run it in a script:

nvram get dhcp_staticlist | sed 's/</\n/g' | grep ":" | awk -F">" '{ print $2">"$1">"$3; }' | \sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n | awk -F">" '{ print $2">"$1">"$3; }' | \sed 's/^/</g' | tr -d '\n' | sed 's/^/nvram set dhcp_staticlist="/' | sed 's/$/"\n/' | tee dhcp_list_sorted_tmp.sh

(This file is good to keep as a backup if you need to clear nvram)

To flash that sorted list/file into router:

sh dhcp_list_sorted_tmp.sh
nvram commit


Make sure you run the scripts in a library where you have full read/write-access.
Thanks :)
 

Latest threads

Sign Up For SNBForums Daily Digest

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