Uploaded by abid rahim

7-dhcp-server

advertisement
DHCP Server
(how to configure dhcp server and setup clients)
Vipin Gupta
vipin2411@gmail.com
BE,RHCE,CEH,CCNA,MCSE,MCSA
Mobile: 93563-10379
www.linuxexpert.in
DHCP (Dynamic Host Configuration Protocol) Introduction
There are 2 ways to assign IP addresses to systems, static and dynamic. In static, we
assign IP addresses our self but in the case of dynamic, one system is given the
responsibility of allocating IP addresses to other systems. For this, we have to
implement DHCP (dynamic host configuration protocol) server.
DHCP server is used allocate dynamic IP address to clients for certain time called
lease time. It maintains pool of IP addresses and allocate these IP address on the
request of client. DHCP server not only allocate IP address, it can also distribute
gateway address, DNS addresses and domain name. It is recommended that when
there are more than 10 systems in a network, instead of giving static IP address, we
should implement DHCP server.
DHCP Server Lab Setup
Install DHCP Server on Master System
yum -q install dhcp
rpm -q dhcp
Static IP Address on Master System
DHCP Server Configuration File
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 172.24.0.0 netmask 255.255.0.0 {
range 172.24.0.101 172.24.0.150;
option domain-name-servers 172.24.0.5, 172.24.0.6;
option subnet-mask 255.255.0.0;
option domain-name "example.com";
option routers 172.24.0.254;
}
DHCP configuration file
“/etc/dhcp/dhcpd.conf”.
is
Various Options and their Meaning
domain-name-servers: the address of DNS servers. if more than one, use comma separated list
routers: router/gateway address
subnet-mask: the subnet
domain-name: domain name
range: the range of IP addresses to be distributed
default-lease-time: the amount of lease time in seconds
max-lease-time: maximum time limit in case of renewals
Start DHCP Server
systemctl start dhcpd
systemctl enable dhcpd
C10 System (Static IP)
C10 System (Dynamically Obtain IP)
C20 System (Static IP)
C20 System (Dynamically Obtain IP)
C30 System (Static IP)
C30 System (Dynamically Obtain IP)
DHCP Server (IP Address Reservation) Lab Setup
Modify DHCP Server Configuration File
default-lease-time 600;
max-lease-time 7200;
authoritative;
subnet 172.24.0.0 netmask 255.255.0.0 {
range 172.24.0.101 172.24.0.150;
option domain-name-servers 172.24.0.5, 172.24.0.6;
option subnet-mask 255.255.0.0;
option domain-name "example.com";
option routers 172.24.0.254;
}
host c20 {
hardware ethernet 00:0c:29:29:ca:fb;
fixed-address 172.24.0.135;}
Modify DHCP configuration file
“/etc/dhcp/dhcpd.conf”.
Various Options and their Meaning
hardware ethernet: for specifying mac address. used for IP address reservation
fixed-address: the address to be reserved
Restart DHCP Server
systemctl restart dhcpd
C20 System (Dynamically Obtain IP)
systemctl restart network
Stop DHCP Server
systemctl stop dhcpd
systemctl disable dhcpd
Download