How To Install and Configure DHCP Server on CentOS 6.3
A short tutorial on how to Install and Configure a DHCP Server on CentOS 6.3 x64, listening on the "eth0" Interface only.
Assumptions and Prerequisites:
- OS: CentOS
6.3 x64.
- Server
Name: mujahid
- DNS
IP: 192.168.1.10
- IPv6
is disabled.
- SELinux
is disabled.
- Firewall
(IPTables) is disabled.
- Subnet: 192.168.1.0/24
- Domain:kirtipatel.com
- Gateway
(Router IP Address): 192.168.1.1
- Text
Editor: Nano
- Dynamic
DNS (DDNS) is not enabled.
Step-by-Step
Instructions:
1. Install the DHCP Package via a terminal.
# yum -y
install dhcp
2. Edit file /etc/dhcp/dhcpd.conf with
"nano" editor and write the following configuration:
# DHCP Server Configuration file.
# see
/usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
# This DHCP server to be declared valid
authoritative;
# Subnet 192.168.1.0/24
subnet 192.168.1.0 netmask 255.255.255.0 {
# default
gateway
option
routers 192.168.1.1;
# domain
name
option
domain-name kirtipatel.com";
# DNS's
hostname or IP address
option
domain-name-servers 192.168.1.10;
# range
of lease IP address
range
dynamic-bootp 192.168.1.2 192.168.1.254;
# default
lease time
default-lease-time 600;
# max
lease time
max-lease-time 7200;
#
broadcast address
option
broadcast-address 192.168.1.255;
##### Reserved Hosts #####
# Router
host router
{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.1;
}
# Farooq
host
farooq {
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.10;
}
# Tariq
host
tariq {
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address
192.168.1.11
}
# Humaira
host
humaira {
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.12;
}
# Khalid
host
khalid {
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.13;
}
# Asim
host asim{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.14;
}
# Mujahid
host mujahid{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.15;
}
# Amir
host
amir{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address
192.168.1.16;
}
# Muneera
host
muneera{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.17;
}
# Atif
host
atif{
hardware
ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.1.18;
}
} # end
of Subnet 192.168.1.0/24
3. edit
file /etc/sysconfig/dhcp to make sure the DHCP service is listening on
the relevant Interface (eth0).
#
nano /etc/sysconfig/dhcp
eg.
DHCPDARGS="eth0"
4. Start
DHCP at boot.
#
chkconfig dhcpd on
5. Start
the DHCP service.
#
/etc/rc.d/init.d/dhcpd start
Comments
Post a Comment