dhcpd.conf – nicer formatting

Keeping an eye on all those entries in a DHCP servers configuration file is a bit tedious. On the other hand, it’s not worrisome enough to use any graphical interface to edit it. One thing I dislike most is the typical format of each entry, that is

host devicename {
      hardware ethernet 12:34:56:78:90:ab;
      fixed-address 123.124.234.127;
  }

I prefer a clean, sorted list, like:

host devicename  {hardware ethernet 12:34:56:78:90:ab;   fixed-address 123.124.234.127; }
host devicename2 {hardware ethernet 12:34:56:78:90:ac;   fixed-address 123.124.234.128; }

Hence, I wrote a script that reads a typical dhcpd.conf file and

  • Outputs all host lines in single-line format
  • Sorts entries by IP
  • Groups entries by /24 subnet

The source code is available on my github: dhcpdformatter

Veröffentlicht unter Tools