Author

Christopher Marshall (christopherlmarshall@yahoo.com)

A DHCP Example Script

#!/bin/bash
#
# this script will run a dhcp server that responds to DHCP requests by 
# doling out addresses in the range 10.0.1.10 to 10.0.1.20

eth_dev=eth1
(
   echo "ddns-update-style none;"
   echo "subnet 10.0.1.0 netmask 255.255.255.0 {"
   echo "   range 10.0.1.10 10.0.1.20;"
   echo "   option routers 10.0.1.1;"
   echo "   option domain-name \"example.net\";"
   echo "   option domain-name-servers 10.0.1.1;"
   echo "}"
) > dhcpd.conf

touch dhcpd.lease
ifconfig $eth_dev 10.0.1.1 netmask 255.255.255.0 up
dhcpd -cf ./dhcpd.conf -lf ./dhcpd.lease -d -f $eth_dev

hopeless_linux: RawNotes/dhcp/example1 (last modified 2007-07-01 16:01:00)