notes blog about


Dynamic Host Configuration Protocol

How DHCP works

  1. Client broadcasts “Help! Who am I?” (on generic all-ones broadcast address as it doesn’t know its netmask yet)
  2. DHCP server negotiates with the client the IP address and other networking parameters
  3. When the client’s lease time is half over, it tries to renew its lease

Setting up a DHCP

  1. Configure /etc/dhcp/dhcpd.conf file
  2. Start the DHCP server in debug mode to verify that the server is working: /usr/sbin/dhcpd -d -f
  3. To start the server for actual use, enter /etc/init.d/isc-dhcp-server start


## Parameters -- describe general configuration
ddns-update-style none;

option domain-name "ianet";
option domain-name-servers,;

default-lease-time 600;
max-lease-time 7200;

log-facility local7;

## Declarations

## Dynamic addresses
subnet netmask {
  # Default GW
  option routers;

# Dummy entry for external interface -- every subnet must be declared, even
#  if no DHCP service is provided on it    
subnet netmask {

## Fixed addresses (not the same as static addresses)
host neptune {
  hardware ethernet 0a:1b:2c:3d:4e:5f;

## bootp support
host bootpneptune {
  hardware ethernet 0a:1b:2c:3d:4e:5f;
  filename "/tftpboot/bootpneptune.boot";

To find out MAC - IP address mapping: ping -c 1 <ip-addr>; /sbin/arp <ip-addr>.



lease {
    starts 5 2004/01/02 10:53:18;
    ends 5 2004/01/02 20:13:57;
    hardware ethernet 00:02:2d:5e:74:8c;
    client-hostname "";

DHCP relay

If you have multiple network segments (with routers in between the segments):