Translation(s): Deutsch - English - Français - Italiano - 简体中文 - Português (Brasil) - Русский

(!) ?Discussion


When you set up a Local Area Network (LAN), a client needs to have certain information, such as the IP-address of its interface, the IP-address of at least one domain name server, and the IP-address of a server in the LAN that serves as a router to the internet. In the manual setup you have to type in this information for each client anew. With the Dynamic Host Configuration Protocol (DHCP) the computers can do that automatically for you. This is particularly convenient for connecting laptops to the network.

For a simple configuration of your network you can set up one computer (e.g. the one connected to the internet) as a DHCP server and each of the other computers as a DHCP_Client.


Install the isc-dhcp-server package.


First you should edit or create the file /etc/default/isc-dhcp-server with root permissions, either by running dpkg-reconfigure isc-dhcp-server or enter something like this into the file /etc/default/isc-dhcp-server:


The main configuration file for a dhcp-server is /etc/dhcp/dhcpd.conf. Remember to make a backup copy of it before you edit the file.

Basic configuration

For a basic configuration, you have to add/edit the following lines in /etc/dhcp/dhcpd.conf. I would leave all other lines as they are.

option domain-name "";

This entry provides the name of the domain, in this case (I am not sure whether and for what this is necessary. I guess it is needed if you want to refer to computers in the LAN by name without domain name, i.e. if you want to refer to computer just with pepper.).

option domain-name-servers,;

This entry provides the IP-addresses of two domain name servers (DNS), but one would be sufficient, too. You have to list here the DNS that work for your internet provider, the addresses given here will most likely not work for you.

subnet netmask {
  option routers;

This entry defines the LAN and the router of the LAN. The IP-addresses to are typical for an intranet. Here only the range to are permitted. is in this case the server connected to the internet that serves as a router.

To make your changes effective you have to restart the DHCP daemon. Run as root

root# service isc-dhcp-server restart

Advanced configuration

Assign fixed addresses

To assign a fixed address, e.g., to a particular machine, e.g. cinnamon, add a statement like the following to the configuration file.

host cinnamon {
  hardware ethernet 00:0D:87:B3:AE:A6;

The cryptic number 00:0D:87:B3:AE:A6 is the hardware address of the interface of cinnamon. It identifies the client to the server. You can get it by running the ifconfig command on the client if the interface is up.

The name (cinnamon) given here is pretty arbitrary at this point and not used for anything yet, as far as I can tell.

More information

Consult the manual pages for advanced options.

user> man dhcpd.conf 

Starting the DHCP server

You can test your DHCP server without rebooting:

sudo service isc-dhcp-server stop
sudo service isc-dhcp-server start
sudo ifdown eth0
sudo ifup eth0

To see your DHCP server error messages, or see when a device has grabbed an IP from this DHCP server:

sudo tail /var/log/syslog

To see if your DHCP server daemon is running:

ps ax | grep dhcpd

Example of a simple DHCP server

If you want your computer to be the DHCP server of an ethernet network, using the IP address for your computer and or higher for the other computers, you can use these configuration settings:

Contents of "/etc/network/interfaces":

# The loopback network interface (always required)
auto lo
iface lo inet loopback

# Assign a static IP for this DHCP server through eth0:
auto eth0
iface eth0 inet static

Contents of "/etc/resolv.conf":

# Use Google public DNS server:
# (or use faster values that your internet provider gave you!)

Contents of "/etc/dhcp/dhcpd.conf:

option domain-name "mydebian";
# Use Google public DNS server (or use faster values that your internet provider gave you!):
option domain-name-servers,;
# Set up our desired subnet:
subnet netmask {
    option subnet-mask;
    option broadcast-address;
    option routers;
    option domain-name-servers home;
default-lease-time 600;
max-lease-time 7200;
# Show that we want to be the only DHCP server in this network:

After running the DHCP server (as mentioned above, or by rebooting), you should be able to attach your other devices to the network and they should automatically be assigned DHCP addresses. To make sure a computer is configured to get its IP address using DHCP, put this into "/etc/network/interfaces":

# The loopback network interface (always required)
auto lo
iface lo inet loopback

# Get our IP address from any DHCP server
auto eth0
iface eth0 inet dhcp

(Or do the equivalent using Network Manager or whatever that device is using to configure its network)

CategoryNetwork CategorySoftware CategorySystemAdministration