Wednesday, April 03, 2013

Setting up DHCP server on Linux | Cent OS 6

Tech Blog - Here is a quick how to setting up DHCP service on a Linux box, this is done on a Cent OS 6 installation, but configuration should apply to other flavours as well.


First we install the dhcpd package from the yum repository

yum -y install dhcp.i686

Once done we edit the configuration file  dhcpd.conf in /etc/dhcp, below configuration will assign IP range 192.168.1.142 to 169, to any client requesting IP it will also assign a fixed/static address to host desktop12 with the MAC address C8:60:00:D0:69:5F.

vi /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#   see 'man 5 dhcpd.conf'
#
ddns-update-style ad-hoc;
default-lease-time 12000;
max-lease-time 92000;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.1.255;
option routers 192.168.1.1;
option domain-name "secretdomain.com";
option domain-name-servers 192.168.1.181;

subnet 192.168.1.0 netmask 255.255.255.0 {
#   range 192.168.1.40 192.168.1.64;
#   range 192.168.1.141 192.168.1.200;
   range 192.168.1.142 192.168.1.169;

}

use-host-decl-names on;
subnet 192.168.1.0 netmask 255.255.255.0 {
        group {
                next-server 192.168.1.181;
                filename "linux/pxelinux.0";
        }
}

# Desktop:
   host desktop12 {
   hardware ethernet C8:60:00:D0:69:5F;
   fixed-address 192.168.1.98;
}

Now we start the DHCP service.

#/etc/init.d/dhcp start 

Then were done.

 



No comments:

For suggestion and concerns E-mail