Galactic Civilizations 3
Install a DHCP server on Debian

Install a DHCP server on Debian

Category: Administration.
Posted by on the 22/07/2013.
Last update on the 24/07/2013.

Description

This tutorial explains how to install and configure a DHCP server on Debian. At the end of this tutorial you will learn how to configure the clients (Debian, Windows XP) in order to use the DHCP server and receive a dynamic address.

Introduction

This tutorial is intended for people under Debian or distributions based on it (Ubuntu, Xandros ...). All commands in this tutorial are executed as root. (su command). It does not require any prerequisites.

Installation of the DHCP server

First of all, we need to install the package dhcp3-server. To do that, execute the following command:

apt-get install dhcp3-server

By default the DHCP server listens the interface eth0. If you want to listen another interface, you need to modify the file /etc/default/dhcp3-server.

INTERFACES= "eth0"

Your DHCP server can also listens more than one interface:

INTERFACES="eth0 eth1"

Configuration of the server

We will now configure the server. But first of all, we will save the default configuration in the case of we have an issue with our new configuration. To do that, execute the following commands:

cd /etc/dhcp3
cp dhcp.conf dhcp.conf.sav

Now, we can edit the configuration file:

nano dhcp.conf

dhcp.conf

option domain-name "my_domain.lan" ;
option domain-name-servers ns1.my_domain.lan ns2. my_domain.lan ;
option routers 192.168.0.1 ;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.50 192.168.0.100 ;
}

  • In the above configuration, my_domain.lan corresponds to the domain name of the local network.
  • ns1.my_domain.lan is the primary DNS server and ns2.my_domain.lan is the name of the secondary DNS .
  • The third line is the webgate's IP address.
  • The last two lines allow to configure the range of dynamic addresses that will be attributed to the users.

When the configuration is done, we need to restart the service by executing the following command:

/etc/init.d/dhcp3-server restart

Client side configuration

Configuration of a Debian user

Normally, the package that allows users to use the DHCP protocol is installed by default. If it is not the case, you can install it by executing the following command:

apt-get install dhcp3-client

Now we will configure the network interface. To do that, execute the following command:

nano /etc/network/interfaces

And edit the file like that:

/etc/network/interfaces

iface eth0 inet dhcp

Now that the user is configured, we can restart the service:

/etc/init.d/networking restart

Configuration of a Windows XP user

  1. Click on the Start menu – Control panel.
  2. Double-click on the icon Network and Internet Connections.
  3. Double-click on the icon of the network interface of your computer.
  4. In the configuration window, double-click on the field Internet Protocol (TCP/IP).
  5. In the configuration window of the protocol, check Obtain an IP address automatically.

    Autonmaticaly get the IP adress from the DHCP server

When clicking on OK, the network interface is configured automatically.

To check the configuration, open the command prompt (Start menu– run – type cmd – ok) and execute the following command:

ipconfig /all

You like this tutorial ?
Like this website in order to promote it on facebook !

You like this tutorial ? Share it with your friends !
Partager sur Facebook Partager sur Twitter Partager sur Myspace Partager sur Stumbleupon Soumettre sur Reddit Partager sur Digg Ajouter à vos favoris Technorati Ajouter à vos favoris Live Ajouter à vos favoris Google Ajouter sur vos favoris Yahoo