How to Install and Configure DHCP Server on Ubuntu Server 14.10 LTS

This is a guide will explain how to install and configure dhcp server on Ubuntu Server 14.10 LTS. The Dynamic Host Configuration Protocol (DHCP) is a network service that enables host computers to be automatically assigned settings from a server as opposed to manually configuring each network host. Computers configured to be DHCP clients have no control over the settings they receive from the DHCP server, and the configuration is transparent to the computer’s user.

The most common settings provided by a DHCP server to DHCP clients include IP address and netmask, IP address of the default-gateway to use and  IP adresses of the DNS servers to use.DHCP server can also supply configuration properties such as: Host Name, Domain Name, Time Server and  Print Server 

Follow the step-by-step installing and configure DHCP Server on Ubuntu Server 14.10 LTS

On this case I’ll using Ethernet device: eth0 with :

  • IP Address range: 192.168.2.10 – 192.168.2.20
  • Subnet address: 192.168.2.0
  • Netmask: 255.255.255.0
  • Domain: preciseserver.public
  • Gateway Address: 192.168.2.1
  • Broadcast Address: 192.168.2.255
  • DNS Servers: 208.67.222.222 and 208.67.220.220 (OpenDNS )

Step 1. install DHCP server package

sudo apt-get install isc-dhcp-server

Step 2. Editing file /etc/default/isc-dhcp-server

sudo nano /etc/default/isc-dhcp-server

On line 11 of this file (Which is actually the last line because this file is basically empty) you will see the line:

INTERFACES=””

Change this line to read:

INTERFACES=”eth0″

# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
#
# This is a POSIX shell fragment
#
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="eth0"

Save and exit

Step 3. Editing file /etc/dhcp/dhcpd.conf

create backup /etc/dhcp/dhcpd.conf

sudo mv /etc/dhcp/dhcpd.conf /etc/dhcp/dhcpd.conf.original

Login as root

sudo -i

Create configuration file dhcpd.conf:

cat > /etc/dhcp/dhcpd.conf <<-EOF
option domain-name "preciseserver.public";
option domain-name-servers ns1.preciseserver.public, ns2.preciseserver.public;
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.2.0 netmask 255.255.255.0 {
range 192.168.2.10 192.168.2.20;
option domain-name-servers 208.67.222.222, 208.67.220.220;
option domain-name "serv.preciseserver.public";
option routers 192.168.2.1;
option broadcast-address 192.168.2.255;
default-lease-time 600;
max-lease-time 7200;
}
EOF

Step 4. restart dhcp server

sudo service isc-dhcp-server restart

Setup Dhcp Client on Ubuntu

To setup dhcp client on ubuntu open System Setting – Hardware – Network  – Select wired – Option – IPv4 Setting – On Method dropdown and select Automatic (DHCP)

Setup Dhcp Client on Windows

Control Panel – Network Connection – Right Click “Local Area Connection” – Properties – Tag General – Double Click “Internet Protocol (TCP/IP” – Select “Obtain an IP address automatically” and “Obtain DNS Server address automatically”