Install DHCP Server on Centos 6.3

 Install DHCP Server on Centos 6.3

1. Install DHCP deamon by yum

[root@Centos6 ~]#
[root@Centos6 ~]# yum install dhcp
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
epel/metalink | 4.4 kB 00:00
* base: mirrors.vonline.vn
* epel: ftp.cuhk.edu.hk
* extras: mirrors.vonline.vn
* rpmforge: mirror-fpt-telecom.fpt.net
* updates: mirrors.vonline.vn
base | 3.7 kB 00:00
extras | 3.5 kB 00:00
rpmforge | 1.9 kB 00:00
updates | 3.5 kB 00:00
updates/primary_db | 3.8 MB 00:45
Setting up Install Process
Resolving Dependencies
–> Running transaction check
—> Package dhcp.i686 12:4.1.1-31.0.1.P1.el6.centos.1 will be installed
–> Processing Dependency: dhcp-common = 12:4.1.1-31.0.1.P1.el6.centos.1 for pac kage: 12:dhcp-4.1.1-31.0.1.P1.el6.centos.1.i686
–> Running transaction check
—> Package dhcp-common.i686 12:4.1.1-31.P1.el6 will be updated
–> Processing Dependency: dhcp-common = 12:4.1.1-31.P1.el6 for package: 12:dhcl ient-4.1.1-31.P1.el6.i686
—> Package dhcp-common.i686 12:4.1.1-31.0.1.P1.el6.centos.1 will be an update
–> Running transaction check
—> Package dhclient.i686 12:4.1.1-31.P1.el6 will be updated
—> Package dhclient.i686 12:4.1.1-31.0.1.P1.el6.centos.1 will be an update
–> Finished Dependency ResolutionDependencies Resolved================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
dhcp i686 12:4.1.1-31.0.1.P1.el6.centos.1 updates 820 k
Updating for dependencies:
dhclient i686 12:4.1.1-31.0.1.P1.el6.centos.1 updates 315 k
dhcp-common i686 12:4.1.1-31.0.1.P1.el6.centos.1 updates 141 kTransaction Summary
================================================================================
Install 1 Package(s)
Upgrade 2 Package(s)Total download size: 1.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): dhclient-4.1.1-31.0.1.P1.el6.centos.1.i686.rpm | 315 kB 00:04
(2/3): dhcp-4.1.1-31.0.1.P1.el6.centos.1.i686.rpm | 820 kB 00:09
(3/3): dhcp-common-4.1.1-31.0.1.P1.el6.centos.1.i686.rpm | 141 kB 00:01
—————————————————————————————————————————————————————————————————–
Total 85 kB/s | 1.2 MB 00:15
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
Updating : 12:dhcp-common-4.1.1-31.0.1.P1.el6.centos.1.i686 1/5
Installing : 12:dhcp-4.1.1-31.0.1.P1.el6.centos.1.i686 2/5Updating : 12:dhclient-4.1.1-31.0.1.P1.el6.centos.1.i686 3/5
Cleanup : 12:dhclient-4.1.1-31.P1.el6.i686 4/5
Cleanup : 12:dhcp-common-4.1.1-31.P1.el6.i686 5/5
Verifying : 12:dhcp-4.1.1-31.0.1.P1.el6.centos.1.i686 1/5
Verifying : 12:dhclient-4.1.1-31.0.1.P1.el6.centos.1.i686 2/5
Verifying : 12:dhcp-common-4.1.1-31.0.1.P1.el6.centos.1.i686 3/5
Verifying : 12:dhclient-4.1.1-31.P1.el6.i686 4/5
Verifying : 12:dhcp-common-4.1.1-31.P1.el6.i686 5/5Installed:
dhcp.i686 12:4.1.1-31.0.1.P1.el6.centos.1

Dependency Updated:
dhclient.i686 12:4.1.1-31.0.1.P1.el6.centos.1 dhcp-common.i686 12:4.1.1-31.0.1.P1.el6.centos.1

Complete!
[root@Centos6 ~]#

 

2. Configure DHCP subnet for our network

[root@Centos6 ~]# cat /etc/dhcp/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see ‘man 5 dhcpd.conf’
#
option domain-name “ithelpblog.com”;
option domain-name-servers 8.8.8.8, 8.8.4.4;
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
authoritative;
subnet 192.168.0.0 netmask 255.255.255.0 {
range dynamic-bootp 192.168.0.10 192.168.0.50;
option broadcast-address 192.168.0.255;
option routers 192.168.0.1;
}
[root@Centos6 ~]#

3. Configure listening Interface to DHCP

[root@Centos6 ~]# cat /etc/sysconfig/dhcpd
# Command line options here
DHCPDARGS=eth0
[root@Centos6 ~]#

4. Start DHCP Server on CentOS

[root@Centos6 ~]# /etc/init.d/dhcpd restart
Starting dhcpd: [ OK ]
[root@Centos6 ~]#

5. Client gets IP Address from DHCP Server

root@ubuntu:~# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:1d:cc:a6 brd ff:ff:ff:ff:ff:ff
inet 192.168.0.10/24 brd 192.168.0.255 scope global eth0
inet6 fe80::20c:29ff:fe1d:cca6/64 scope link
valid_lft forever preferred_lft forever
root@ubuntu:~#root@ubuntu:~# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.0.1 0.0.0.0 UG 100 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0

That’s all. Thanks for using IThelpblog.com

Tags:  

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>