From Fedora Project Wiki


Managing DHCP Server

DHCP (Dynamic Host Configuration Protocol) allows DHCP or BOOTP clients on the network to request the basic network configuration information. This information includes the IP address, subnet netmask, the address of the router, and the DNS domain name and the DNS server's IP address and in Fedora is provided by the dhcpd daemon.

Single DHCP server per subnet is the common setup. If installed, DHCP forwarding agents allow DHCP clients to receive the network information from servers that are located on a different network segments. DHCP server assigns leased addresses for the predetermined amount of time, configured in the dhcpd.conf file. DHCP server keeps track of leased addresses by placing them in the /var/lib/dhcp/dhcpd.leases file.

Installing DHCP Server

To install DHCP server, run:

su -c "/usr/bin/yum install dhcp"

Configuring DHCP Server

/etc/dhcpd.conf is the configuration file for the DHCP server. Once dhcp rpm package is installed, empty /etc/dhcpd.conf file is available. The file is empty in the sense that it doesn't provide any configuration but points to the location of the sample configuration file that can be used as a base. /etc/dhcpd.conf may look similar to the following:

# global options
ddns-update-style none;   # Dynamic DNS updates are turned off
option domain-name "example.com";   # DNS domain name assigned to client
option domain-name-servers 192.168.1.10;   # IP address of the DNS server
max-lease-time 172800;   # maximum lease time - 2 days
default-lease-time 86400;   # seconds till lease expire - 1 day
subnet 192.168.1.0 netmask 255.255.255.0

{
option routers 192.168.1.1;   # default gateway
option subnet-mask 255.255.255.0;   # netmask assigned to clients
range 192.168.1.150 192.168.1.249;   # pool of the addresses to lease
}

To assign the WINS server, or nmbd part of the Samba server to Windows DHCP clients, use the following options, either globally or per appropriate subnet:

option netbios-name-servers 192.168.1.11;   # IP address of the Samba or WINS server
option netbios-node-type 0x08;   # equivalent of the MS WINS type "hybrid"

In addition, /etc/dhcpd.conf may include the information about the NIS server, NTP (Network Time Protocol) server, etc.

DHCP server also allows for the permanent assignment of the particular IP address, based on the client's MAC address, which is commonly used for BOOTP clients:

host station3 {
hardware ethernet 00:0B:DB:14:C9:40;
fixed-address 192.168.1.103;
}

To start the DHCP server, run:

su -c "/sbin/service dhcpd start"

To enable DHCP server at boot time, run:

su -c "/sbin/chkconfig dhcpd on"

Additional Information

Related Manuals

  • man 8 dhcpd
  • man 5 dhcpd.conf