DHCP
DHCP
What is DHCP?
It gives IP Addresses Automatically to the Clients who is requesting for an IP Address Centralized IP Address Management DHCP prevents IP address Conflicts and helps conserve the use of client IP Address on the Network DHCP reduces the complexity and amount of
Why DHCP ?
Static IP Assigning
IP addresses are entered manually IP address could be entered incorrectly Communication and network issues can result Frequent computer moves increase administrative effort
Dynamic IP Assigning
IP addresses are supplied automatically Correct configuration information is ensure Client configuration is updated automatically A common source of network problems is eliminated
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
r oveer 9b i ic ov - -d 9b DDssc 2cc11d a2 P HC P 77-3 a fff DD HC5eecc--3ffff-ff-ffff : : 5 ffff ff-ff f rrm FFoomToo: : ff T
5e7c-3a2c-1d9d 5e7c-3a2c-1d9d
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
DHCP Server broadcast DHCP Server broadcast a DHCPOFFER packet a DHCPOFFER packet
IP address Pool 192.168.0.101 192.168.0.102
Client Client
192.168.0.2 192.168.0.2
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b 5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
t esst 9b equue - - d b RReqa2cc11d99a P HC P c-3 a2 -d 9a f DDHC5e77c-3a2c-11d oof e : : 5e c-33a2c asse r r m e7 - r e a .1 FFoom: 55e7tcfoorLLe .00.1 oo : es t f .1688. TT u s 2 .16 eq e 9 RR eqIu : :1192 PP I
5e7c-3a2c-1d9b 5e7c-3a2c-1d9b
5e7c-3a2c-1d9c 5e7c-3a2c-1d9c
FFro
DHCP Request DHCP Request From : :5e7c-3a2c-1d9b From 5e7c-3a2c-1d9b To : :5e7c-3a2c-1d9a To 5e7c-3a2c-1d9a
50%
10
5e7c-3a2c-1d9a 192.168.0.100 5e7c-3a2c-1d9a DHCP Offer DHCP Offer From : :5e7c-3a2c-1d9a From 5e7c-3a2c-1d9a To : :5e7c-3a2c-1d9b To 5e7c-3a2c-1d9b
Extend Lease by 66Hours for Extend Lease by Hours for IP : :192.168.0.1 IP 192.168.0.1
11
Assigning IP address dynamically has some problems that every time a client system boots it is not sure that it will get the same IP so it will be uneasy task for other systems to find the particular system. To solve the above problem we can do mac-address binding of the IP s. Just give its entry in the fixedaddress portion.
12
Requirements
13
14
Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1 ~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt [root@comp1 ~]# mount 192.168.0.250:/var/ftp/pub/RedHat/RPMS/ /mnt [root@comp1 ~]# cd /mnt [root@comp1 ~]# cd /mnt [root@comp1 ~]# rpm -ivh dhcp* --force --aid [root@comp1 ~]# rpm -ivh dhcp* --force --aid
Sample configuration file location Sample configuration file location /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample Copying Sample file for Configuration Copying Sample file for Configuration [root@comp1 ~]# cp /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample [root@comp1 ~]# cp /usr/share/doc/dhcp3.0.1/dhcpd.conf.sample /etc/dhcpd.conf /etc/dhcpd.conf
15
/etc/dhcpd.conf
To change the range and other options To change the range and other options default-lease-time 21600; default-lease-time 21600; subnet 192.168.0.0 netmask 255.255.255.0 { subnet 192.168.0.0 netmask 255.255.255.0 { option routers 192.168.0.254; option routers 192.168.0.254; option subnet-mask 255.255.255.0; option subnet-mask 255.255.255.0; option domain-name zoom.com"; option domain-name zoom.com"; option domain-name-servers 192.168.0.253; option domain-name-servers 192.168.0.253; range 192.168.0.1 192.168.0.100; } range 192.168.0.1 192.168.0.100; } To bind mac-address to IP address To bind mac-address to IP address host server2 { host server2 { option host-name server2.zoom.com"; option host-name server2.zoom.com"; hardware ethernet 5E:7C:3A:2C:1D:9D; hardware ethernet 5E:7C:3A:2C:1D:9D; fixed-address 192.168.0.254; } fixed-address 192.168.0.254; }
16
DHCP Server
To restart the DHCP services To restart the DHCP services [root@comp1 ~]# service dhcpd restart [root@comp1 ~]# service dhcpd restart
17
DHCP Client
Linux
Install the package by using one of the installation methods Install the package by using one of the installation methods [root@comp1~]# mount 192.168.0.250:/var/ftp/pub/RedHat /RPMS/ [root@comp1~]# mount 192.168.0.250:/var/ftp/pub/RedHat /RPMS/ /mnt /mnt [root@comp1 ~]# cd /mnt [root@comp1 ~]# cd /mnt [root@comp1 ~]# rpm -ivh dhclient* --force --aid [root@comp1 ~]# rpm -ivh dhclient* --force --aid
To get IP address from DHCP server To get IP address from DHCP server [root@comp1~]# dhclient [root@comp1~]# dhclient or or [root@comp1 ~]# netconfig [root@comp1 ~]# netconfig Check the box use dynamic IP configuration Check the box use dynamic IP configuration
18
DHCP Client
Windows
Configuring DHCP Client Configuring DHCP Client Select My Network Places .. Select My Network Places Right click Properties .. Right click Properties Select Local Area Connection Select Local Area Connection Right click Properties .. Right click Properties Double Click Internet Protocol (TCP/IP) Double Click Internet Protocol (TCP/IP) Select Option Obtain an IP Address automatically Select Option Obtain an IP Address automatically
19