Build DHCP Server

author: Liangzhi Zou
date: 2001/19/7

  The Dynamic Host Congiguration Protocol(DHCP) is an Internet protocol for automating the configuration of computers that use TCP /IP. DHCP can be used to automatically assign IP addresses, to deliver TCP/IP stack configuration parameters such as the subnet mask and default router, and to provide other configuration information such as the addresses for printer,time and news servers.

  This page records process that I build DHCP server of Solution Garden in 10art-ni Corporation,Japan. And provides some information about DHCP.

1.Operation System
 Redhat Linux 6.2

2.DHCP Source
 dhcp-2.0-5.i386.rpm

3.Edit dhcpd.conf file

 The dhcpd.conf file is a free-form ASCII text file. It is parsed by the recursive-descent parser built into dhcpd. The file may contain extra tabs and newlines for formatting purposes. Keywords in the file are case-insensitive.

 Declarations are used to describe the topology of the network,to describe clients on the network,to provide address that can be assigned to clients,or to apply a group of parameters to a group of declarations. In any group of parameters and declarations,all parameters must be specified befor any declarations which depend on those parameters may be specified.

 Declarations about network topology and connect about them is below:
   
         share-network
         |
         |---->subnet
	       |
	       |---->group
	             |
                     |---->host


 Example - A typical dhcpd.conf file will look something like below:

 global parameters...

 shared-network NET-ZOU{
   shared-network-specific parameters...
   subnet 204.254.239.0 netmask 255.255.255.224{
     subnet-specific parameters...
     range 204.254.239.10 204.254.239.30;
   }
   subnet 204.254.239.32 netmask 255.255.255.224{
     subnet-specific parameters...
     range 204.254.239.42 204.254.239.62;
   }
 }
 
 subnet 204.254.239.64 netmask 255.255.255.224{
   subnet-specific parameters...
   range 204.254.239.74 204.254.239.94;
 }

 group{
   group-specific parameters...
   host client1.zou.net{
     host-specific parameters...
   }
   host client2.zou.net{
     host-specific parameters...
   }
 }

The network topology of Solution Garden:


The dhcpd.conf file of Solution Garden:
#dhcpd.conf

#demo.com
subnet 192.168.0.0 netmask 255.255.255.0{
  server-identifier 192.168.0.1;
  option domain-name "demo.com";
  option domain-name-servers 192.168.0.1;
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.0.255;
  option routers 192.168.0.1;
  default-lease-time 6000;
  max-lease-time 72000;
  range 192.168.0.100 192.168.0.150;
}

#virtual.com
subnet 192.168.10.0 netmask 255.255.255.0{
  server-identifier 192.168.10.1;
  option domain-name "virtual.com";
  option domain-name-servers 192.168.10.1;
  option subnet-mask 255.255.255.0;
  option broadcast-address 192.168.10.255;
  option routers 192.168.10.1;
  default-lease-time 6000;
  max-lease-time 72000;
  range 192.168.10.100 192.168.10.150;
}

4.Move modified dhcpd.conf to /etc directory.

5.Create dhcpd.lease file in /var/state/dhcp/ directory.

6.Modify /etc/rc.d/init.d/dhcpd file
  #dhcpd
  ...
  start)
    #Start daemons;
    echo -n "Starting dhcpd:"
    daemon /usr/sbin/dhcpd --> daemon /usr/sbin/dhcpd eth1 eth2
  ....
7.Make DHCP server automatically on in runlevel 345,even the system be reboot.
 #chkconfig --level 345 dhcpd on
Hosted by www.Geocities.ws

1