Wednesday, December 3, 2008

Redhat Linux DHCP Server Configuration Guide

Linux Based DHCP server is controlled by dhcpd daemon (Disk Access and Execution Monitor). It main configuration file is placed in /etc/dhcpd.conf. But remember you will find this file in /etc because you will have to manually create it or copy it from dhcpd server sample file.

Steps for Redhat Linux based dhcp server.
1. Assign a static ip address to linux server. Using netconfig or ifcfg
2. Check if dhcp server is installed.
rpm -q dhcp
you will notice that dhcp-3.xxxx result will be displayed.

3. copy the dhcpd.conf file from sample documentation.
cp /usr/share/doc/dhcp-3.3/dhcpd.conf.sample /etc/dhcpd.conf

4. Now open this sample file by using vi /etc/dhcpd.conf and a very simple dhcp configuration is given below. It works for most of the Home or Office networks. Advance users may configure more options as per their requirements.

ddns-update-style interim
ignore client-updates

subnet 192.168.1.0 netmask 255.255.255.0 { # Our subnet

range 192.168.1.201 192.168.1.220; # our range
default-lease-time 86400;
max-lease-time 86400;
option routers 192.168.1.1; # our router or gateway
option ip-forwarding off;

# You can also assign specific IP addresses based on the clients'
# ethernet MAC address as follows (Host's name is "laser-printer":

host laser-printer { # client reservation
hardware ethernet 08:00:2b:4c:59:23;
fixed-address 192.168.1.222;
}
}

Step.5 is save the file by using :wq in vi command
step.6 # service dhcpd start [OK]
---------------------------------------------------------------
Step 7 For monitoring of dhcp server startup
cat /var/log/messages

step 8. cat /var/lib/dhcp/dhcpd.leases file contains the assinged ipaddress of the server.
step 9 # chkconfig --level 35 dhcpd on this command will start dhcp server on every boot.

No comments: