DHCPv4 HOWTO (ISC-DHCP)

The Internet Software Consortium’s DHCP daemon software is perhaps the most well-known implementation available. Free as in beer, it comes standard or can be installed on most Linux distributions.

The dhclient is the client suite of the Internet Software Consortiums’s DHCP server software. It is normally installed alongside its server counterpart, dhcpd.

Configuration is in readable text:

# Configuration file for /sbin/dhclient, which is included in Debian's
# dhcp3-client package.
option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name "";
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
netbios-name-servers, netbios-scope, interface-mtu,
rfc3442-classless-static-routes, ntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;
#alias {
# interface "eth0";
# fixed-address 192.5.5.213;
# option subnet-mask 255.255.255.255;
#}

DHCP Server configuration is done in a nested fashion, by declaring subnets, settings and hosts in that subnet, for example:

ddns-update-style none; // Do not update Dynamic DNS entries
authoritative; // Declares this DHCP server to be the primary one on this network
ping-check true; // Check if an IP is in use before giving it out
subnet 192.168.0.0 netmask 255.255.255.0 { // What subnet are we using?
deny unknown-clients; // Do not allow unknown machines on the network
range 192.168.0.100 192.168.0.150; // Serve addresses from this range
option domain-name-servers 4.4.4.4, 8.8.8.8; // The DNS-servers
option ntp-servers time.nasa.gov; // Specifies the NTP-server in use
option domain-name "dhcp.net";
option routers 192.168.0.254;
option broadcast-address 192.168.0.255;
next-server 192.168.0.200; // Used for TFTP/PXE/netbooting
filename "pxelinux.0"; // File loaded from the TFTP server
default-lease-time 86400; // By default, give out addresses for 24 hours
max-lease-time 86400; // Do not allow clients use addresses for more than 24 hours
host staticserver { // Give the machine this hostname
hardware ethernet 00:1f:d3:6e:3a:7c; // This MAC address...
fixed-address 192.168.0.180; // ...is offered this IP
}
}