Latest Entries »

How to Install and Configure DHCP Server


My sincere gratitude goes to Mr. Anuradha Jayakody and Mr. Rajitha Tennekoon of Sri Lanka Institute of Information Technology for teaching me these valuable concepts. Most of the below configurations are taken from the lab sheets written by them. 

Prerequisites

Centos 5.5 installed in VMWare.
Stop the LDAP service.
Set VMware network settings to NAT and make your server IP settings to obtain IP address automatically.
Restart the network service on CentOS.

Installation and configuration Steps

Type the following command and install DHCP.
yum install –y *dhcp*
After you install the DHCP service, change your network settings to VMNET2 and assign your server static IP address.

Warning: If you do not configure the network settings to VMNET2 this installation will mess-up and harm entire company network.

Check the server’s IP is configured to 10.0.1.2 ( Specially you have to make sure, your server has been configured to static IP address)

 What is the command you have used to check the IP settings?
ifconfig
Type following command to copy the sample DHCP file given by the installation. Importantly, you have to remember that, this is the file we are going to configure as the DHCP server. Any misconfiguration of this file will effect to the smooth functionality of the DHCP server.
cp -f /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf
If it asks to over write the file, over write it. Understand and write down what is the backup file here? And what is the configuration file we will be using here?
Back up file - dhcpd.conf.sample Configuration file - dhcpd.conf
Type following command to edit the dhcpd.conf file
gedit /etc/dhcpd.conf
If you don’t have following 3 lines in your DHCPD.conf file add them. And google for them and find what are meanings of those lines.

ddns-update-style interim;
#ignore client-updates;
allow client-updates; 


DYNAMIC DNS UPDATES

The DHCP server has the ability to dynamically update the Domain Name System.Within the configuration files, you can define how you want the Domain Name System to be updated. These updates are RFC 2136 compliant so any DNS server supporting RFC 2136 should be able to accept updates from the DHCP server.

Two DNS update schemes are currently implemented, and another is planned. The two that are currently available are the ad-hoc DNS update mode and the interim DHCP-DNS interaction draft updatemode. If and when the DHCP-DNS interaction draft and the DHCID draft make it through the IETF standards process, there will be a third mode, which will be the standard DNS update method. The DHCPserver must be configured to use one of the two currently-supported methods, or not to do dns updates. This can be done with the ddns-update-style configuration parameter.

THE INTERIM DNS UPDATE SCHEME

The interim DNS update scheme operates mostly according to several drafts that are being considered by the IETF and are expected to become standards, but are not yet standards, and may not be standardized exactly as currently proposed.

These are:
draft-ietf-dhc-ddns-resolution-??.txt
draft-ietf-dhc-fqdn-option-??.txt
draft-ietf-dnsext-dhcid-rr-??.txt

Because our implementation is slightly different than the standard, we will briefly document the operation of this update style here.

The first point to understand about this style of DNS update is that unlike the ad-hoc style, the DHCP server does not necessarily always update both the A and the PTR records. The FQDN option includes a flag which, when sent by the client, indicates that the client wishes to update its own A record. In that case, the server can be configured either to honor the client's intentions or ignore them. This is done with the statement allow client-updates;or the statement ignore client updates; By default, client updates are allowed.  

ddns-update-style interim : Now we have our information, so let's configure the server by creating a text file named /etc/dhcpd.conf. The first line in the file must be the DNS update scheme. There are 2 choices, but only one that works reliably ... so we will use that one.That is ddns-update-style interim  

ignore client-updates : allow the DHCP to update client info to a Dynamic DNS server. In our example, we are not going to try and update a Dynamic DNS via our DHCP server, so we will not allow client updates.

Dynamic DNS service

Dynamic DNS is provided by companies to allow users with Dynamic IP addresses to obtain a Domain Name that will always by linked to their changing IP address. The IP address is updated by either client software running on a computer or by a router that supports Dynamic DNS, whenever the IP address changes.

Carefully change following areas and understand each and every line and make a note that why exactly those lines are?

subnet 10.0.1.0 netmask 255.255.255.0 {
# --- default gateway
option routers 10.0.1.1;
option subnet-mask 255.255.255.0;
option nis-domain "blogspot.com"; 
option domain-name "blogspot.com"; 
option domain-name-servers
option time-offset -18000; # Eastern Standard Time 
allow booting; 
allow bootp; 
range dynamic-bootp 10.0.1.6 10.0.1.254;
default-lease-time 21600 max-lease-time 43200; 

Then comment the function named as 

host ns { ......
}

What is BootP? 

BOOTP, short for Bootstrap Protocol, is a protocol used to allow an Ethernet network device to obtain an IP Address over the network. 

A device that wants to obtain an IP address broadcasts a BootP request that identifies the device by its MAC address, an identifying six octet number ( ex: 00:A0:45:08:CD:8D) that is uniquely assigned to a device by its manufacturer. A BootP server on the network, sees the request and sends a BootP reply containing a desired IP address (ex: 192.168.1.10) to the device, thereby making it now become accessible to higher level network communications using that IP address. 

Save the file. 

Edit the following file and give the IP address that client need to contact and the Ethernet interfaceclients need to contact to obtain IP address from the server.

gedit /etc/sysconfig/dhcrelay 

INTERFACES="eth0" 
DHCPSERVERS="10.0.1.1" 

dhcrelay agent 

DESCRIPTION 

The Internet Systems Consortium DHCP Relay Agent, dhcrelay, provides a means for relaying DHCP and BOOTP requests from a subnet to which no DHCP server is directly connected to one or more DHCP servers on other subnets. 

OPERATION 

The DHCP Relay Agent listens for DHCP and BOOTP queries and responses. When a query is received from a client, dhcrelay forwards it to the list of DHCP servers specified on the command line. When a reply is received from a server, it is broadcast or unicast (according to the relay agent’s ability or the client’s request) on the network from which the original request came. 

Save the file and restart the DHCP service using 

service dhcpd restart 

Configure your client centos machines to obtain IP address form the DHPC service and verify that client has obtained an IP address from the given range of the IP addresses.

References

http://www.daemon-systems.org/man/dhcpd.conf.5.html 
http://wiki.answers.com/Q/What_is_the_BOOTP_protocol_used_for_where_might_you_find_it_in_Windows_network 

2 comments:

  1. What Linux version are you using? May be your repositories are not set. This command is working.

    ReplyDelete

මෙම ලිපිය පිළිබද ඔබේ අදහසත් ලියලම යන්න

Add to Google Reader or Homepage

Bloggers - Meet Millions of Bloggers

Add to My AOL Add to netvibes