Install a DHCP server in Linux

To set up a DHCP server, start by download the latest version at the Internet Software Consortium; it is important that the latest version is used as it is the most secure and will be running on your server.

  1. Download the DHCP server (the current version can be found here):

  2. Untar the archive

    tar xzf ./dhcp-4.2.1-P1.tar.gz
  3. Move to the new directory containing the untared files:

    cd dhcp-4.2.1-P1
  4. Execute these commands to configure and make the source into executable binaries:

  5. All going well, switch to root and install the server:

    sudo make install

    You will be prompted for the root password and, if you entered it correctly, the new DHCP server will be installed  

  6. Configure the server; start by copying the default configuration file from the installation directory into /etc:

    sudo cp server/dhcp.conf /etc
  7. Now edit the configuration file (I use nano however any text editor, such as vi, can be used):

    nano /etc/dhcp.conf
  8. My DHCP configuration is very simple, the entire file is:

    subnet netmask {
    	option domain-name-servers; # This is the DNS server, usually your modem's IP
    	option domain-name "home";           # DNS name, this line is optional
    	option broadcast-address; # Useful for multicasting, e.g. VLC
    	option subnet-mask;        # This is the default for 10.x.x.x networks
    	option routers;             # This is your gateway, again usually your modem's IP
    	range;          # IP range. The first computer to ask for an IP will
    																				# be the last will be after which
    																				# all IP addresses will be exausted (i.e. max 50 IPs)
  9. You can perminantly assign an IP address to a computer with the following additions:

    				hardware ethernet 00:00:00:00:00:00;  # Replace with the machine's MAC address


How do I install DHCP on my Linux Server?