DHCP configuration

Dhcp uses the following files:
  1. /etc/dhcpd.conf: Configuration file
  2. /var/state/dhcp/dhcpd.leases : "Leases file", containging dynamically allocated addresses


This contains the listing of the complete file, rather than just a diff.

# dhcpd.conf
# Configuration file for ISC dhcpd
# Hosts with more than one interface MUST specify a ``server-identifier'',
# which should be the IP address of the server's primary network interface,
# or if there is no interface that can be described that way, at least an
# interface whose address isn't likely to change.
server-identifier dhcp-server.ltnb.lu;
As said in the comment, this should be a valid hostname for the dhcp server (dhcp-server.ltnb.lu does indeed resolve to, the server's IP address)

# option definitions common to all supported networks...
option domain-name "ltnb.lu";
Domain name, and name server IP, passed to the client's.

option domain-name-servers ns;
Name server's IP address, passed to the client (it is the server who resolves ns to its IP address, the DHCP reply packet will contain the actual address:

# Shared network declaration is used to group subnets which share the same
# physical network together.   The name is specified so that the shared
# network can be referred to in log messages - it serves no other function.
shared-network LTNB {
DHCP allows to manage several "shared-networks". We only use one, but this container nevertheless needs to be present.

# option definitions common to this shared network.
  option subnet-mask;
Subnet mask, sent to client

#  default-lease-time 86400;
#  max-lease-time 259200;
# AK: reduce leases temporarily before the weekend:
  default-lease-time 21600;
  max-lease-time 43200;
Default & max lease times: how long may a client keep an address until it needs to refresh it? Lowered to maked it easier to 6h/12h to make it easyer (faster) to manage addresses.

# One of the two IP subnets that share this physical network
# Address ranges can be specified for each subnet attached to
# a shared network.   Since these subnets share the same physical
# network, addresses are pooled together, and assignments are made
# without regard to the actual subnet.   If the optional dynamic-bootp
# keyword is given in the address range declaration, then addresses
# in that range can be assigned either with the DHCP protocol or the
# BOOTP protocol; otherwise, only DHCP clients will have addresses
# allocated from the address range.
# Note that each IP subnet can have its own options specific to that subnet.
# options that aren't specified in the subnet are taken from the shared
# network (if any) and then from the global option list.
  subnet netmask {
Second (inner) container defining out network.

#    range dynamic-bootp;
     range dynamic-bootp;
Dynamically assigned addresses. These addresses will be used for machines not (yet) explicitly listed in this file.

    option netbios-name-servers;
    option netbios-dd-server;
    option netbios-node-type 8;
    option broadcast-address;
    option routers gate;
Other parameters communicated to the client in the DHCP packet. Mostly windows related stuff, except the last two: network broadcast address, and address of gateway to outside.

    host L-01 {
      hardware ethernet 00:10:dc:99:50:85;
One definition of a DHCP client. One such definition is present for each computer that gets its address via DHCP. Here the explanation of the various parameters:
host L-01.
The logical name of the computer. Is often the Windows computer name (and the DNS name) but doesn't need to be.
hardware ethernet 00:10:dc:99:50:85
MAC address of ethernet card of client machine. This is how the DHCP server distinguishes the clients among each other. If the MAC address is not given, the server tries to use the Windows computer name (specified above). Problem: in a situation where the Windows computer name changes too often, this may not be such a good idea...

Apart from that, if the ethernet card of a machine needs to be replaced (should happen more rarely than changing the windows computer name), think about updating dhcpd.conf

fixed-address IP address to be assigned
After this follow all other hosts...

Closing braces for shared-network and subnet


This file is maintained by DHCP, and records which computer has which IP address currently. Only dynamically allocated IPs are tracked in here. The file is interesting for getting data (MAC address) about new computers. Just connect the computers, assign them a Windows name, have them operate some time, and in the evening "collect" the data and copy it over to dhcpd.leases.

One entry looks as follows:

lease {
        starts 6 2001/03/03 18:48:37;
        ends 0 2001/03/04 00:48:37;
        hardware ethernet 00:60:08:51:17:a2;
        uid 01:00:60:08:51:17:a2;
        client-hostname "STOCKIMAGE";
lease Dynamically assigned address. When moving entry to dhcpd.conf, do not keep the same, as this address is in the reserved "dynamic" range. Pick an address corresponding to the place where the machine stands instead.
starts 5 2001/02/23 14:43:52; Time when this lease started
ends 5 2001/02/23 20:43:52; Time when this lease expires(d). Clinet should renew it before expiry, or risk losing its IP
hardware ethernet 00:10:dc:93:50:7b; Mac address. Should be copied as-is into dhcpd.conf
uid 01:00:10:dc:93:50:7b; Mac address, again (but with a preceding 01 this time)
client-hostname "RR-99"; Windows computer name. Can be copied as is.
N.B. Dhcp is only responsible for assigning IP addresses. DNS name to IP address mapping is done by the DNS. So, when adding new machines, think of configuring the DNS as well!