DHCP Dynamic Host Configuration Protocol allows network settings configuration for all clients from a central dhcp server. The dhcp clients request an IP address and other network settings to all dhcp servers listening on the local LAN where the client is connected. The dhcp server leases to the client one IP address based on the client MAC or just from a IP range, then the client accepts the configuration served by the dhcp server and notify it to the dhcp server.
1. Installing DHCP server:-
[root@base ~]# yum install dhcp
2. The copy the sample configuration file from shared/doc to /etc/dhcpd/dhcpd.conf file.
[root@base ~]# cp -r /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
3. Edit configuration file:-
[root@base ~]# vim /etc/dhcp/dhcpd.conf
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local6;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
#subnet 10.152.187.0 netmask 255.255.255.0 {
#}
# This is a very basic subnet declaration.
#subnet 10.254.239.0 netmask 255.255.255.224 {
# range 10.254.239.10 10.254.239.20;
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
#}
# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.
#subnet 10.254.239.32 netmask 255.255.255.224 {
# range dynamic-bootp 10.254.239.40 10.254.239.60;
# option broadcast-address 10.254.239.31;
# option routers rtr-239-32-1.example.org;
#}
# A slightly different configuration for an internal subnet.
subnet 192.168.4.0 netmask 255.255.255.0 {
range 192.168.4.1 192.168.4.100;
option broadcast-address 192.168.4.131;
default-lease-time 600;
max-lease-time 7200;
}
wq:- save and exit
note:- comment all the entries to be away from configuration error
4. Restart DHCP server:-
[root@base ~]# /etc/init.d/dhcpd restart;chkconfig dhcpd on
DHCP client site configuration
opent network configuration file and make changes:-
[root@base ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="dhcp"
HWADDR="B8:70:F4:45:EC:63"
NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
UUID="d04a3609-1a3c-4eec-be7b-70bf05d4cf8a"
No comments:
Post a Comment