DHCP Server

###How to configure DHCP Server on Debian###

   I.            What is DHCP?

Dynamic Host Configuration Protocol (DHCP) is a network protocol that enables a server to automatically assign an IP address to a computer from a defined range of numbers (i.e., a scope) configured for a given network.

DHCP assigns an IP address when a system is started, for example:

  1. A user turns on a computer with a DHCP client.
  2. The client computer sends a broadcast request (called a DISCOVER or DHCPDISCOVER), looking for a DHCP server to answer.
  3. The router directs the DISCOVER packet to the correct DHCP server.
  4. The server receives the DISCOVER packet. Based on availability and usage policies set on the server, the server determines an appropriate address (if any) to give to the client. The server then temporarily reserves that address for the client and sends back to the client an OFFER (or DHCPOFFER) packet, with that address information. The server also configures the client’s DNS servers, WINS servers, NTP servers, and sometimes other services as well.
  5. The client sends a REQUEST (or DHCPREQUEST) packet, letting the server know that it intends to use the address.
  6. The server sends an ACK (or DHCPACK) packet, confirming that the client has a been given a lease on the address for a server-specified period of time.

When a computer uses a static IP address, it means that the computer is manually configured to use a specific IP address. One problem with static assignment, which can result from user error or inattention to detail, occurs when two computers are configured with the same IP address. This creates a conflict that results in loss of service. Using DHCP to dynamically assign IP addresses minimizes these conflicts.

For more detail, please refer to this one: http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol

      II.            Installation Process

  • Step 1: Install the package of DHCP Server

root@dns:~# aptitude -y install dhcp3-server

  • Step 2: I need to backup the file of DCHP server

root@dns:~# cd /etc/dhcp/

root@dns:/etc/dhcp# ls

dhclient.conf           dhclient-exit-hooks.d

dhclient-enter-hooks.d  dhcpd.conf

root@dns:/etc/dhcp# cp dhcpd.conf dhcpd.conf_backup

root@dns:/etc/dhcp#

  • Step 3: Go to create pool for DHCP client

root@dns:/etc/dhcp# nano dhcpd.conf

# The ddns-updates-style parameter controls whether or not the server will

# attempt to do a DNS update when a lease is confirmed. We default to the

# behavior of the version 2 packages (‘none’, since DHCP v2 didn’t

# have support for DDNS.)

ddns-update-style interim;

ddns-updates on;

option domain-name “thoren.lan”;

option domain-name-servers 192.168.1.12;

default-lease-time 600;

max-lease-time 7200;

#Range of DHCP Server

subnet 192.168.1.0 netmask      255.255.255.0

{

range 192.168.1.10 192.168.1.30;

option  routers 192.168.1.1;

}

  • Step 4: Start service of DHCP Server

root@dns:/etc/dhcp# /etc/init.d/isc-dhcp-server start

Starting ISC DHCP server: dhcpd.

  • Step 5: Configure DHCP service run on startup once the server is restarted

root@dns:/etc/dhcp# insserv isc-dhcp-server

  • Result of DHCP Client retrieve the ip address from DHCP Server

##You have done a good job###

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment