Thursday, 5 December 2013

How to configure DHCP Server

Hello... Friends , Today we are going to Configure a DHCP server ( Dynamic Host Configuration Protocol ) is used to assign IP address and other staff like gateways and DNS details automatically to the clients. we need a DHCP server configured for offering ipaddress to the clients when it is required.

type :SysteV-managed service
package:dhcp
Daemon: /user/sbin/dhcp
script : /etc/init.d/dhcpd
ports : 67 (bootps),68 (bootpc)
conf. file : /etc/dhcpd.conf, /var/lib/dhcpd/dhcpd.leases
related: dhclient,dhcpv6-client,dhcpv6

So let's start
Step 1: install the dhcp package by command # yum install dhcp-* -y



Step 2: After installing dhcp server pagkage along with dependencies. Assign a static ip as 192.168.56.101 in the same DHCP range for the listening interface as mine is "eth1" this dhcp server package create network scripts for the interface. have a look in /etc/sysconfig/network-scripts here we have a script file ifcfg-eth1 this file contains all the information to make the ip static open the file with text editor # vi /etc/sysconfig/network-scripts/ifcfg-eth1 ( your may be eth0 ) depend on the network interface  edit this interface file here we can define our static IP , mask ,gateway etc.

Step 3: Now open /etc/sysconfig/dhcpd file and add the preferred interface name to DHCPDARGS variable as below add the value as eth0 or eth1 according to your interface


Step 4: Now open the /etc/dhcp/dhcpd.conf file and edit it as per requirement for more or if you are configuring this file first time the i am suggesting you to open up the manual file as mention in the file that see sample file "/usr/share/doc/dhcp*/dhcpd.conf.sample" i want to clear here in this file we can define server static ip address , DNS ,Domain name , DNS IP , lease time ,log method , subnet & iprange, broadcast-address,Mac ip etc.

ok i am configuring this file according to my need you can configure it according to yours but the point to be noted here is open the sample file & see the configuration. i am defining here my ip address,gateways ,hardware address etc. to find this info ifconfig in new tab :)

so now just # cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
copy the sample conf file into main dhcpd.conf  file it ask for overwrite then yes it

edit dhcp.conf file as
I just make change in two portions of the file
here
# A slightly different configuration for an internal subnet.
host server portion :)



Now Restart the service # service dhcpd start

So here is our sort Description on DHCP server . 

0 comments:

Post a Comment