Tuesday 7 June 2011

DHCP


Domain Host Configuration Protocol (DHCP)

Dynamic Host Configuration Protocol (DHCP) is network protocol for automatically assigning TCP/IP information to client machines. The Dynamic Host Configuration Protocol (DHCP) was designed to help ration IP addresses. A DHCP server leases a specific IP address to a computer network card for a limited, but renewable, amount of time. DHCP servers can lease IP addresses on different LANs using the BOOTP protocol.
Configuration files:
1.  /etc/dhcpd.conf                                       (Server configuration file)
2.  /var/lib/dhcpd/dhcpd.leases                  (Clients lease database file)
3.  /var/lib/dhclient/dhclient-eth0.leases  (Client side lease info file)

            Requirements:
1.    Assign static IP address to DHCP Server.

# setup                                                       (For assign IP of server)    
# service network restart   
# chkconfig --list network
# chkconfig network on 
# chkconfig --list dhcpd                        (For check the dhcpd list)
# hostname                                               (For check the host name)

# vi /etc/hosts                                   (Hosts name file will open, leave two starting line and below two line write below line)
            <Ip of server> <host name>         (who we want give)
Ex.192.168.100.1 server.iiht.com
# yum install dhcp
# cp /usr/share/doc/dhcp-3.0.5/dhcpd.conf.sample /etc/dhcpd.conf
(For copy dhcp.conf.sample file to /etc/dhcpd.conf)
# vim /etc/dhcpd.conf                    (For open dhcp.conf file and write in the below line Firstly press :se nu for give no. to all line)
Line no. 4      give subnet and net mask of a network
Line no. 7      give subnet of Router if we don’t have router so give # sign
Line no. 10    give NIS name if don’t’ have so give # sign
Line no. 11    in this line we will give our server name Ex. linux.com
Line no. 12    in this line we will give IP of Server Ex.192.168.100.1
Line no. 21    in this line we will give IP range EX 192.168.100.1 192.168.100.254
Press Esc :wq!
Note :- after # given in the starting of line it means this line not execute
           
Ex:-
ddns-update-style interim;
ignore client-updates;

subnet 192.168.1.0 netmask 255.255.255.0 {

# --- default gateway
#     option routers                  192.168.0.1;
#     option subnet-mask              255.255.255.0;

#     option nis-domain               "domain.org";
option domain-name              "server.linux.com";
option domain-name-servers      192.168.1.3;

option time-offset              -18000; # Eastern Standard Time
#     option ntp-servers              192.168.1.1;
#     option netbios-name-servers     192.168.1.1;
# --- Selects point-to-point node (default is hybrid). Don't change this unless
# -- you understand Netbios very well
#     option netbios-node-type 2;

range dynamic-bootp 192.168.1.12 192.168.1.25;
default-lease-time 21600;
max-lease-time 43200;

# we want the nameserver to appear at a fixed address
host ns {
next-server marvin.redhat.com;
hardware ethernet 12:34:56:78:AB:CD;
fixed-address 207.175.42.254;
        }
}

# service network restart
# chkconfig --list dhcpd
# service dhcpd restart
# chkconfig dhcpd on
# chkconfig --list dhcpd          (After fire this command dhcpd service will on on 2, 3, 4 & 5 terminal)

Static IP Address using DHCP: To assign an IP address to a client based on the MAC address of the network interface card.
    
host clientpc {
          option host-name "clientpc.linux.com";
          hardware ethernet 00:A0:78:8E:9E:AA; 
          fixed-address 192.168.1.30;
}


Client Side:-
# setup            (For enable DHCP select “Use DHCP”)
# service network restart

Client obtains IP from DHCP server automatically after fire above command.

No comments:

Post a Comment

Boot to UEFI Mode or legacy BIOS mode

Boot to UEFI Mode or legacy BIOS mode Choose UEFI or legacy BIOS modes while installing Windows. After Windows is installed, if you nee...