Steps to install and configure a DHCP Server


This configuration will work on all RPM based linux distributions (Redhat,Fedora,CentOS,etc.)

Configure 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.
Step1Install dhcp packages
[root@server ~#]yum install dhcp
Step2: Edit the dhcp configuration file located in /etc/dhcp/dhcpd.conf
[root@server ~#]vi /etc/dhcp/dhcpd.conf
#[Note: The lines to add or edit in dhcpd.conf file is colored brown. Enable the lines by removing ‘#’ if required and edit. Allways backup the configuration file before editing.]
#Add your domain name
option domain-name    "vjetnamnet.com";
#Add DNS  server addresses(for clients)
option domain-name-servers 10.10.10.10, 8.8.8.8;
#Set lease time
default-lease-time 600;
#set maximum lease time
max-lease-time 7200;
#activate dhcp server
authoritative;
#Add your ip address pool in below format. In this example network 10.10.10.0/24 and ip address pool is 10.10.10.200  to 250 for clients,gateway=10.10.10.10.
subnet 10.10.10.0 netmask 255.255.255.0 {
  range dynamic-bootp 10.10.10.200 10.10.10.250;
  option broadcast-address 10.1010.255;
  option routers 10.10.10.10;
}
#This is the way to Reserve an ip address 10.10.10.29  for a special client named Accounts . [ MACaddress based reservation]. Here 00:E0:5D:A0:6A:0C is the mac address of accounts pc’s NIC card(optional).
host Accounts {
  hardware ethernet 00:E0:5D:A0:6A:0C;
  fixed-address 10.10.10.29;
}
Step3: Start dhcp service
[root@server ~#]service dhcpd start
Step4: Add dhcp service to startup
[root@server ~#]chkconfig dhcpd on
Step5: To do in client computers
Set Obtain ip automatically in all windows and “Use DHCP” in linux client computers.