Ubuntu DHCP Server

ubuntu-logo32In this post I will be describing setting up Ubuntu 14.04 LTS as a DHCP server.

The steps in this guide have been tested on a clean install of Ubuntu 14.04 LTS server, but should be applicable to most Debian based distributions (Linux Mint etc).

For more information on the DHCP protocol have a look at my previous post “Fundementals: DHCP“.

DHCP server config

We will be using the Internet Systems Consortium (ISC) DHCP server package available from the default Ubuntu repositories. To install the package issue the following command:

Now that we have the package installed, we need to tell it which interface it should listen for DHCP requests on. To do this we need to edit the /etc/default/isc-dhcp-server file and specify the interfaces as follows:

Sample output of /etc/default/isc-dhcp-server:

Next, we need to edit the /etc/dhcp/dhcpd.conf file, to include the DNS servers, Gateway, Subnet, Subnet mask etc. We will also make the DHCP server the primary server on the network by setting it to be authoritative:

Set the DNS servers for the network, in this case I will be using Googles DNS servers (8.8.8.8 and 8.4.4.4). This is a global setting for all supported networks.

Setup the subnet, subnet mask, gateway, scope of addresses for the network you want to lease to clients. At this stage you can also specify separate DNS servers from those assigned globally.

We will be configuring the server to use the following information:

  • Subnet: 192.168.56.0
  • Subnet mask: 255.255.255.0
  • Scope (range): 192.168.56.100 to 192.168.56.254
  • DNS servers: 8.8.8.8 and 8.4.4.4
  • Domain: routingloops.co.uk
  • Gateway (router): 192.168.56.1
  • Broadcast address: 192.168.56.255

Sample output of the /etc/dhcp/dhcpd.conf file:

Lastly we will restart the DHCP daemon so it will use the new config:

References:
http://www.unixmen.com/setup-dhcp-server-ubuntu-14-04-lts-server/
http://www.isc.org/downloads/dhcp/
https://help.ubuntu.com/community/isc-dhcp-server

FacebookTwitterGoogle+Share

Leave a Reply