Saturday, 21 November 2009

Install and Configure quickly a DHCP Server

NOTE: These commands have been tested in Debian version unstable.

DHCP stands for Dynamick Host Configuration Protocol. This protocol allows to automatically obtain an IP address and set the network configuration.

We install a DHCP server:
#aptitude install dhcp3-server

Next step is configuring the DHCP server:
We have to set correcty the /etc/dhcp3/dhcpd.conf file.

There is a configuration file example at:

e.g: I added these lines to my /etc/dhcp3/dhcpd.conf

subnet netmask {
option routers;
option domain-name-servers,;

subnet and netmask indicate the network addresses of our network:
e.g: subnet netmask match,, and IP addresses.

range means which addresses can be returned by our dhcp server, here, it can return and

routers indicates the gateway

domain-name-servers shows all dns addresses separated by commas.

Once we have correctly set dhcpd.conf file we restart the dhcp daemon:
#/etc/init.d/dhcp3-server restart

If everything has gone fine, we will execute in a client computer:
$sudo dhclient eth0

and the dhcp server will associate an IP adress to eth0 interface.

NOTE: dhcp3-client package provides dhclient command.
#aptitude install dhcp3-client

0 comentarios: