Wednesday, January 2, 2013

DHCP configuration

DHCP ( Dynamic Host Configuration Protocol ) helps you to assign IP address to the clients automatically based on the predefined pool of IP addresses.

A. DHCP server set up

1. Install DHCP software package
# yum install dhcp

2. Once installed, configure your dncp
# cat /etc/sysconfig/dhcpd
Note: You specify your interface here.

3. Now, copy sample dhcp configuration for your DHCP configuration
# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample  /etc/dhcp/dhcpd.conf

4. Edit the config file and make following parameter change.
# cat  /etc/dhcp/dhcpd.conf
option domain-name "expanor.local";
option domain-name-servers,;

default-lease-time 600;
max-lease-time 7200;
log-facility local7;

# Update subnet details as per your network.
# our network is
subnet netmask

option routers;
option subnet-mask;
option domain-search "expanor.local";
option domain-name-servers;
# Specify Eastern Standard Time
option time-offset -18000;

## Pre-assign IP address to your host

host sama
option host-name "ruma.expanor.local";
hardware ethernet 00:0B:DB:C6:05:07;

5. Now, restart the services

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

6 Configure log server to capture log
Note: syslog might have already been installed. if now
# rpm -qa | grep rsyslog
# yum search rsyslog
# yum install rsyslog

a. Append the following at the end of the config file
# tail -f /etc/rsyslog.conf
     –local7.* /var/log/dhcpd.log

Once you made change, restart the syslog service
# service rsyslog restart

b. Once you restart the service, it should start writing to log file.
# tail -f /var/log/dhcpd.log


B. Configure DHCP Client

1. Login to your system and edit network configuration
# cat  /etc/sysconfig/network-scripts/ifcfg-eth0

# service network restart
# ifconfig

Note: Most of the places, you will see commercial products used on most of the companies. They are for specific purpose and might be for specific environment. On real production, we always use static IP

No comments:

Post a Comment