Module – 17 Dynamic Host Configuration Protocol (DHCP)

What is DHCP?

DHCP ( Dynamic Host Configuration Protocol ) is a network protocol used for assigning IP address to network clients dynamically from predefined IP pool. It is useful for LAN network, but not generally used for production servers.

dhcp

 

Step:1

Install the DHCP package

# yum install dhcp

Step:2

vi /etc/sysconfig/dhcpd
    –DHCPDARGS=eth1

Step:3

 

# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf

Step:4

vi /etc/dhcp/dhcpd.conf
option domain-name "example.com";
option domain-name-servers host1.example.com, host2.example.com;
default-lease-time 600;
max-lease-time 7200;
authoritative;
log-facility local7;

# Update subnet details as per your network.
# For this example we are configuring DHCP for 192.168.1.0/24 LAN network.
subnet 192.168.1.0 netmask 255.255.255.0 

{
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-search "tecadmin.net";
option domain-name-servers 192.168.1.1;
option time-offset -18000;# Eastern Standard Time
range 192.168.1.10 192.168.1.100;
}

## Option to Assign Static IP Address to Host 
 
host station1 
{
option host-name "station1.example.com"; 
hardware ethernet 00:11:1A:2B:3C:AB;
fixed-address 192.168.1.100;
}

Step:5

 

# service dhcp stop
# service dhcp start
# chkconfig –levels 345 dhcp on

Step:6 Setup Log server

 

You can configure <syslog> service to capture the logs

# yum install –y rsyslog*
# vi /etc/rsyslog.conf
     –local7.* /var/log/dhcpd.log
# service rsyslog restart

To check DHCP log:

tail -f /var/log/dhcpd.log

Step:7 Configure Client Servers to get IP from master:

# vi  /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=dhcp
TYPE=Ethernet
ONBOOT=yes
&
# service network restart

Leave a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>