Monday, 12 March 2012

[ CentOS 5 ] DHCP Server

DHCP Server
Set DHCP ( Dynamic Host Configuration Protocol ) Server. If you make your linux computer DHCP server, it's neccesarry to disable DHCP function on router in LAN.

 
Step [1] Install DHCP and configure
[root@dlp ~]#
yum -y install dhcp

[root@dlp ~]#
cp -f /usr/share/doc/dhcp*/dhcpd.conf.sample /etc/dhcpd.conf

[root@dlp ~]#
vi /etc/dhcpd.conf
# line 4: specify your network and subnetmask

subnet
10.0.0.0
 netmask
255.255.255.0
 {
# line 7 : specify default gateway

option routers
10.0.0.1
;
# line 8: specify subnetmask

option subnet-mask
255.255.255.0
;
# line 10: specify NIS domain name iy you using.
# make it comment if you don not use.

option nis-domain
"server.world"
;
# line 11: specify domain name

option domain-name
"server.world"
;
# line 12: specify IP address of DNS

option domain-name-servers
10.0.0.30
;
# line 14: make it comment

#
option time-offset
-18000;
# line 21: specify the range of IP addresses for clients

range dynamic-bootp
10.0.0.200 10.0.0.254
;
# line 22: default's terms of lease

default-lease-time
21600
;
# line 23: maximun terms of lease

max-lease-time
43200
;
# line 26: make following lines comment

#
host ns {

#
next-server marvin.redhat.com;

#
hardware ethernet 12:34:56:78:AB:CD;

#
fixed-address 207.175.42.254;

#
}
[root@dlp ~]#
/etc/rc.d/init.d/dhcpd start

Starting dhcpd:
[  OK  ]

[root@dlp ~]#
chkconfig dhcpd on
Step [2] Configure on client. This example is on Windows 7.
Open Network settings and go to the sacreen like below.
Step [3] Check boxes like below, then IP address is re-configured automatically.
Step [4] See the network status. Automatical configuration is done.