Saturday, December 03, 2011

DHCP Server Configuration


Introduction:-
Dynamic Host Configuration Protocol (DHCP) automatically assigns IP addresses and other network configuration information (subnetmask, broadcast address, etc) to computers on a network. A client configured for DHCP will send out a broadcast request to the DHCP server requesting an address. The DHCP server will then issue a "lease" and assign it to that client. The time period of a valid lease can be specified on the server.
  • DHCP assignment:
    • Lease Request: Client broadcasts request to DHCP server with a source address of 0.0.0.0 and a destination address of 255.255.255.255. The request includes the MAC address which is used to direct the reply.
    • IP lease offer: DHCP server replies with an IP address, subnet mask, network gateway, name of the domain, name servers, duration of the lease and the IP address of the DHCP server.
    • Lease Selection: Client recieves offer and broadcasts to DHCP servers that will accept given offer so that other DHCP server need not make an offer.
    • The DHCP server then sends an ack to the client. The client is configured to use TCP/IP.
    • Lease Renewal: When half of the lease time has expired, the client will issue a new request to the DHCP server.
Requirement:-
  • Package = dhcp
  • Service = dhcpd
  • Port No. = 67
  • Configuration File = /etc/dhcpd.conf
Per quest:-
  • Configure IP = 192.168.1.1
  • Configure Hostname = server.rootuser.in
  • Firewall must be disabled.
1] Install required package
[root@server ~]# yum install dhcp* -y

2] Copy the new sample file and paste it under /etc directory
[root@server ~]# cp /usr/share/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf

3] Edit the dhcpd.conf file as follows: ( Make changes which are denoted in BOLD format)
[root@rootuser ~]# vi /etc/dhcpd.conf
ddns-update-style interim;
ignore cient-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
options nis-domain “domain.org”;
option domain-name “rootuser.in”;
option domain-name-servers 192.168.1.1;

option time-offset -1800; # Eastern
# option ntp-servers 192.168.1.1;
# option netbios-name-servers 192.168.1.1;
# --- Selects point-to-point node ( default is hybrid )
# -- You understand Netbios very well
# option netbios-node-type 2;

range dynamic-bootp 192.168.1.10 192.168.1.100;
default-lease-time 21600;
max-lease-time 43200;
# we want to nameserver to appear at a fixed address
host client {
next-server client.rootuser.in;
hardware ethernet 12:AH:CD:78:43:GI;
fixed-address 192.168.1.50;
}
:wq

4] Crete one blank file to store allocated ip address to client
[root@server ~]# touch /var/lib/dhcpd/dhcp.ip

5] Start dhcp service
[root@server ~]# service dhcpd start
[root@server ~]# chkconfig dhcpd on

DHCP Client Side:-
1] Set the ip address to dynamic from LAN card properties
[client@server~]# setup
Select the Network configureation --> Select Edit Network Devices --> Select device eth0 --> Select option Use DHCP [ * ] --> Then Ok --> Quit --> Save&quit --> Quit

2] Restart network service
[root@server ~]# service network restart
[root@server ~]# chkconfig network on

3] Now check IP address for eth0 device
[root@server ~]# ifconfig eth0

No comments: