Ubuntu

How to install DHCP server on Ubuntu 14.04/14.10/15.04

The Dynamic Host Configuration Protocol (DHCP) is a standardized network protocol used on Internet Protocol (IP) networks for dynamically distributing network configuration parameters, such as IP addresses for interfaces and services. With DHCP, computers request IP addresses and networking parameters automatically from a DHCP server, reducing the need for a network administrator or a user to configure these settings manually.
In this article will explain how to install and configure DHCP server on Ubuntu server 14.04/14.10/15.04

Install DHCP server on Ubuntu Server 14.04/14.10/15.04

To install a DHCP server on Ubuntu Server 14.04/14.10/15.04 enter the following command:

# sudo apt-get install isc-dhcp-server -y

Configure DHCP Server

The DHCP server is not difficult to configure. After installing, open /etc/default/isc-dhcp-server file:

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

and assign the network interface:

......
INTERFACES="eth0"

First, we need to define to below values in dhcpd.conf file located in /etc/dhcp/ directory.
Example scenario:

Network : 192.168.1.0/24
Range : 192.168.1.50 ( Starting IP ) – 192.168.1.100 ( Ending IP )
Gateway : 192.168.1.1
Primary DNS : 192.168.1.2
Sec DNS : 8.8.8.8
# sudo nano /etc/dhcp/dhcpd.conf

and add the below code after making changes as per your network values.

# option definitions common to all supported networks...
default-lease-time 600;
max-lease-time 7200;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
 
subnet 192.168.1.0 netmask 255.255.255.0 {  #network
	range 192.168.1.50 192.168.1.100; # Range
	option domain-name-servers 192.168.1.2, 8.8.8.8; #Pri DNS , Sec DNS
	option domain-name "lintut.com"; #Domain name 
	option routers 192.168.1.1; #Gateway
	option broadcast-address 192.168.1.255; #Broadcast
	default-lease-time 600;
	max-lease-time 7200;
}

After making all the changes you want, save and close the configuration file. Restart the dhcp service by using the following command:

# sudo service isc-dhcp-server restart

That’s it. DHCP server is up and ready.

Cheers!

2 Comments

  1. IMHO the best DHCP server for a home network is dnsmasq. It’s integrated with a dns server so dhcp clients get added into your local dns. It’s also one of the easiest and most flexible dhcp and dns servers to configure, and has a built-in tftp server too, making it a one-stop-shop for booting thin clients. Despite all the features, it’s not bloated, and has a smaller installed package size and less dependencies than isc-dhcp-server.

    The only other things you need for a fully featured local network are an ldap server (for sharing user accounts across machines), and an nfs server (for sharing home directories).

  2. it is a statistical machine is allocated an IP address that does not
    Information including the machine name, MAC address, IP Address is allocated

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Close