dhcp config for 200 users via single file

Jesse Norell jesse at kci.net
Mon Jan 14 20:40:27 UTC 2008


On Mon, 2008-01-14 at 00:33 +1100, Glenn Satchell wrote:
> 
> # can also put them on one line
> host fred { hardware ethernet 00:11:22:33:44:55; fixed-address
> 192.168.1.6; }
> 
> repeat the host statements, the label in the host line can be any
> unique 
> identifier.

You can generate this from your input format with something like:

$ cat myfile.txt
00-08-74-4D-74-DE   10.0.0.10    # john flat 303 sunview appartment
00-53-45-00-00-00   10.0.0.11    # david a43 aone banglows

$ sed s/-/:/g < myfile.txt | awk '{print "host " NR " { hardware
ethernet " $1 "; fixed-address " $2 "; }"}'
host 1 { hardware ethernet 00:08:74:4D:74:DE; fixed-address 10.0.0.10; }
host 2 { hardware ethernet 00:53:45:00:00:00; fixed-address 10.0.0.11; }

Save that output to a file and "include" that file in your main
dhcpd.conf.  Then simply re-run that command and reload dhcpd for
changes (and perform error checking if you want :).


-- 
Jesse Norell
Kentec Communications, Inc.
jesse at kci.net


More information about the dhcp-users mailing list