Setup and configure DHCP server

This entry was posted in Networking, Unix, Windows and tagged on June 17, 2012, by

1 . First of all install the dhcp package

# rpm -ivh dhcp-3.0pl1-9.i386.rpm

2. After the installation, look for Dhcp file, normally the sample file is stored in /usr/share/doc/dhcp-versionnumber/dhcp.conf.sample. Whenever the dhcp service will start it will read for /etc/dhcp.conf file. So copy this sample file to dhcpd.conf

# cd /usr/share/doc/dhcp-version/

# cp dhcp.conf.sample /etc/dhcp.conf

Here is teh explanation of /etc/dhcp.conf file

# vi /etc/dhcp.conf

 

ddns-update-style interim # Redhat version 8.0 +

subnet 192.168.1.0 netmask 255.255.255.0 {

# The range of IP addresses the server

# will issue to DHCP enabled PC clients

# booting up on the network

range 192.168.1.201 192.168.1.220;

# Set the amount of time in seconds that

# a client may keep the IP address

default-lease-time 86400;
max-lease-time 86400;

# Set the default gateway to be used by

# the PC clients

option routers 192.168.1.1;

# Don’t forward DHCP requests from this

# NIC interface to any other NIC

# interfaces

option ip-forwarding off;

# Set the broadcast address and subnet mask

# to be used by the DHCP clients

option broadcast-address 192.168.1.255;
option subnet-mask 255.255.255.0;

# Set the DNS server to be used by the

# DHCP clients

option domain-name-servers 192.168.1.100;

# You can also assign specific IP addresses based on the clients’

# ethernet MAC address as follows (Host’s name is “smallfry”:

host smallfry {

hardware ethernet 08:00:2b:4c:59:23;
fixed-address 192.168.1.222;

}

3. Start the dhcp service

# chkconfig –level 35 dhcp on

# service dhcp start

The dhcp server will be started.

4. So now go on to the client system which has ethernet address 08:00:2b:4c:59:23 , it will automatically take ip address 192.168.1.222

5. Rest of the clients will take randomly ip’s from range 192.168.1.201 to 192.168.1.220.

Leave a Reply

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

Copyright 2017 ©Aceadmins. All rights reserved.