3 The configuration file

Next, you need to edit the configuration file “/etc/dhcp3/dhcpd.conf”.

Now, let us consider some thing that we can do with the rest of this file:

subnet 10.0.2.0 netmask 255.255.255.0 {  
}  
  

This configures the subnet to only use static IP address. Although we can simply turn of the DHCP server, this makes it possible to switch back to use a DHCP server.

Now, let us consider a more common setting:

subnet 10.0.2.0 netmask 255.255.255.0 {  
  option broadcast-address 10.0.2.255;  
  option routers 10.0.2.2;  
  range 10.0.2.32 10.0.2.63;  
}  
  

This configures the DHCP to assign addresses from 10.0.2.32 to 10.0.2.63. It also configures 10.0.2.2 as the gateway (called routers in this context). 10.0.2.255 is the broadcast address, but that’s to be expected with the subnet and netmask configuration.

host 10.0.2.25 {  
  hardware ethernet 52:54:00:12:34:59;  
  fixed-address 10.0.2.25;  
}  
  

This configures that if a NIC with the MAC address of 52:54:00:12:34:50 asks for an IP address, it will be 10.0.2.25.

Once you are done editing the configuration file, you have to restart the DHCP server using “/etc/init.d/dhcp3-server restart”.