SOURCECODEBD.NET

Live Experience

CentOS 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.

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

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

# line 4: specify your network and subnetmask
subnet 192.168.0.0 netmask 255.255.255.0 {

# line 7 : specify default gateway
option routers  192.168.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.info";

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

# line 12: specify IP address of DNS
option domain-name-servers  192.168.0.10;

# line 14: make it comment
#option time-offset  -18000;

# line 21: specify the range of IP addresses for clients
range dynamic-bootp  192.168.0.128 192.168.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@ns ~]# /etc/rc.d/init.d/dhcpd start
Starting dhcpd: [ OK ]
[root@ns ~]# chkconfig dhcpd on

[2] In Windows open the LAN interface go to properties and go to IP Configuration option and select the Optain IP Address Autometically.

You are here: Home / CentOS / DHCP Server on CentOS