DHCP Server

From Knowledge76

Jump to: navigation, search

Overview

This article describes how to setup DHCP services on Ubuntu Server Edition.

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
  • DNS
  • WINS

However, a DHCP server can also supply configuration properties such as:

  • Host Name
  • Domain Name
  • Default Gateway
  • Time Server
  • Print Server

The advantage of using DHCP is that changes to the network, for example a change in the address of the DNS server, need only be changed at the DHCP server, and all network hosts will be reconfigured the next time their DHCP clients poll the DHCP server. As an added advantage, it is also easier to integrate new computers into the network, as there is no need to check for the availability of an IP address. Conflicts in IP address allocation are also reduced.

A DHCP server can provide configuration settings using two methods:


MAC Address

This method entails using DHCP to identify the unique hardware address of each network card connected to the network and then continually supplying a constant configuration each time the DHCP client makes a request to the DHCP server using that network device.


Address Pool

This method entails defining a pool (sometimes also called a range or scope) of IP addresses from which DHCP clients are supplied their configuration properties dynamically and on a fist come first serve basis. When a DHCP client is no longer on the network for a specified period, the configuration is expired and released back to the address pool for use by other DHCP Clients. This is the most common DHCP server setup.

Ubuntu is shipped with both DHCP server and client. The server is dhcpd (dynamic host configuration protocol daemon). The client provided with Ubuntu is dhclient and should be installed on all computers required to be automatically configured. Both programs are easy to install and configure and will be automatically started at system boot.


Installation

At the terminal issue the following command to install the DHCP server.

sudo apt-get install dhcp3-server


Configuration

Open the dhcp3-server configuration file.

sudo nano /etc/dhcp3/dhcpd.conf

Add your network specific settings to the file.

default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 10.10.1.255;
option routers 10.10.1.254;
option domain-name-servers 10.10.1.1, 10.10.1.2;
option domain-name "mydomain.lan";

subnet 10.10.1.0 netmask 255.255.255.0 {
range 20.20.1.100 10.10.1.200;
}

Restart the DHCP service

sudo /etc/init.d/dhcp3-server restart

Your server is now providing addresses and network information to client computers.

Personal tools