Installing DHCP server in Debian

Valic —  June 1, 2010 — Leave a comment

Why you need DHCP server?

DHCP is useful for fast delivery of client network configuration. When configuring the client system, the administrator can choose DHCP and not have to enter an IP address, netmask, gateway, or DNS servers. The client retrieves this information from the DHCP server.
DHCP is also useful if an administrator wants to change the IP addresses of a large number of systems. Instead of reconfiguring all the systems, he can just edit one DHCP configuration file on the server for the new set of IP address. If the DNS servers for an organization changes, the changes are made on the DHCP server, not on the DHCP clients. Once the network is restarted on the clients (or the clients are rebooted), the changes will take effect.

Step 1. Installing DHCP server

#apt-get install dhcp3-server

Once you press enter installation will start it will ask you some questions just you need to click ok for all three times

Step 2. Configuring DHCP server

The main Configuration file for DHCP server is


Before doing any changes take backup copy of this file and add the following lines

option domain-name "";
option domain-name-servers,;
option routers;
default-lease-time 3600;
subnet netmask {

Each on of the above line is explained below

First line provides the name field for the clients, second line gives DNS for for the clients, third one is for router ip,fourth one is lease time fifth line is subnet and netmask details, sixth line is ipaddress range for your clients

If you want more details in dhcpd.conf file check the man page of this file

If you want to configure static ipaddress for some machines follow this

host hostname {
hardware ethernet 00:B0:CF:8B:49:37;

Each one of the above line is explained below

First line name of the host you want to configure static ip address,second one is MAC address of that perticular machine,if you want to find the MAC address of that machine you need to run the “ifconfig” command,third one is ipaddress you want to assign to that perticular machine.

Step 3. You need to restart the DHCP daemon to take effect of your new changes.

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

If it restarts without any errors your configuration is correct. If you get any errors you need to check the log files for more error information

#tail /var/log/messages

The following file give you the complete details about the DHCP clients connecting to the DHCP server this details includes the following

IP address of the client machine

MAC address of the client machine

Name of the client machine

Beginning and ending of ipaddress lease time

Step 4. Client Machine Configuration

You need to modify the following file

# mcedit /etc/network/interfaces

You need to add the following lines and save the file.

auto lo eth0

iface lo inet loopback

iface eth0 inet dhcp

Now you need to restart the networking service to take these new changes

#/etc/init.d/networking restart

If you want to check your machine is configured properly you need to run the following command




Posts Twitter Facebook

Editor in Chief at Debian-Tutorials, Linux enthusiast.

No Comments

Be the first to start the conversation.

Leave a Reply