Dhcp Example - Line-by-Line
Warning: This site does not allow %INCLUDE% of URLs
Download the above example by clicking
here
Lets take it apart, line by line.
option subnet-mask 255.255.255.0;
Passes the netmask to the client.
option broadcast-address 192.168.0.255;
Passes the broadcast address to the client;
option routers 192.168.0.254;
passes the default gateway to the client.
option domain-name-servers 192.168.0.254;
Passes the nameserver to the client.
option domain-name "your_domain.org";
Passes the domain name to the client.
get-lease-hostnames true;
Tells dhcpd to do a lookup in /etc/hosts or in DNS to get the hostname that goes along with the IP address that is being allocated for the workstation. It then passes that hostname to the client.
next-server 192.168.0.254;
This tells the client what machine is serving TFTP. When using ISC dhcpd version 3.0.2 or older,
you didn't need to include this line, if your TFTP server was the same as your DHCP server. But, since version 3.0.3 of dhcpd, it is no longer defaulted, so you MUST include this line, even if they are the same machine.
option root-path "192.168.0.254:/opt/ltsp/i386";
Tells the client 2 things:
- The IP address of the NFS server.
- The directory on the server to mount as the workstations root directory.
subnet 192.168.0.0 netmask 255.255.255.0 {
.
.
.
}
A
subnet declaration is required for each interface that dhcpd is listening on. This example shows a single subnet, indicating that dhcpd is only listening on one interface.
range 192.168.0.100 192.168.0.199;
This instructs dhcpd to dynamically assign addresses from a pool of addresses, with the value of the last octet being between
.100 and
.199. dhcpd typically assigns addresses starting at the end of the pool, working forward, but there is no guarantee of this, and as leases are granted and released, the order of the allocations will become more and more random.
if substring (option vendor-class-identifier, 0, 9) = "PXEClient" {
This is an
if statement that checks the value of the first 9 bytes of the
vendor-class-identifier. This is how dhcpd can tell whether the
DHCP-REQUEST is coming from a
PXE bootrom, or an Etherboot bootrom. We need to have this question here, because each type of bootrom requires a different file to be downloaded to the client.
filename "/tftpboot/lts/2.4.26-ltsp-3/pxelinux.0";
This is the filename that will be handed to the client, if it is a PXE bootrom that made the request. The file shown in this example is a NBP (Network Bootstrap Program).
filename "/tftpboot/lts/vmlinuz-2.4.26-ltsp-3";
This is the filename that will be handed to the client, if it is NOT a PXE bootrom that made the request. The filename shown in this example is a Linux kernel plus an initrd (initial ramdisk) image that has been prepared with the
mknbi-linux program.