Configuring the DHCP Service
Give out IPs using ISC-DHCP 3.0.3 (FreeBSD 5.4)
Posted 30.06.2005 | Updated 23.05.2006 | Contributed by Andy Mallett & Nick Fratangelo


Nick has helped me simplify this install quite significantly, compared to the original instructions.

A Unix based DHCP Server is straightforward to configure and back up and is much, much less fussy and more reliable than running the Microsoft DHCP Service from a Windows Server. You can take my word for that..

Getting the files

This document has been revised for version 3.0.3 of ISC-DHCP. Download the source file dhcp-3.0.3.tar.gz from a Google search.. (849KB).

Installation

Perform a standard installation..

tar -zxvf dhcp-3.0.3.tar.gz
cd dhcp-3.0.3
./configure
make
make install

Configuration

Create the following files..

touch /var/db/dhcpd.leases
cp /src/dhcp-3.0.3/server/dhcpd.conf /etc
vi /etc/dhcpd.conf


Here's an example dhcpd.conf file..

# Andy's dhcpd.conf

default-lease-time 600;
max-lease-time 7200;
ddns-update-style ad-hoc;

# option definitions common to all supported networks..
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.50 192.168.0.90;
option routers 192.168.0.101;
option domain-name-servers 192.168.0.101;
option domain-name "domain.net";
}

# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;

# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;

#Example reserved IP..
host wireless1.domain.net {
hardware ethernet 00:04:23:21:51:50;
fixed-address 192.168.0.100;
}


The above config file will give out IPs from 192.168.0.50 to 192.168.0.90 with a default Class C Subnet Mask of 255.255.255.0. I prefer to express the DNS Server and Gateway as IP Addresses rather than host names. Additionally an example of a reserved IP Address is shown, which would lock the specified IP to the specified MAC Address. Add a 4-5 line entry like this, per reserved IP.

Starting the DHCP service

The dhcpd daemon lives in /usr/sbin/dhcpd, which is in the system path. So to start the service, simply type:

dhcpd

Any configuration errors will be displayed - fix them before you can start the service. Success can be seen with a running dhcpd process..

ps -aux | grep dhcpd

root   1548  0.0  0.5   420   264  p0  D+   11:08AM   0:00.00 grep dhcpd
To view the DHCP leases, type:

more /var/db/dhcpd.leases

This file can be edited to remove previous leases and will regenerate parts of itself when a lease is given out.

Finally, to run the daemon from startup we put an entry line into rc.local..

vi /etc/rc.local

/usr/sbin/dhcpd


Related Links

http://ezine.daemonnews.org/200207/dhcp.html
http://www.isc.org/products/DHCP
http://www.onlamp.com/pub/a/bsd/2003/05/01/FreeBSD_Basics.html

DHCP Service Tweaks

Since installing ISC-DHCP we have added a few modifications to the service

- Make the DHCP Service log to its own file
- DHCP Service sends an administrative email if new system joins..
- DHCP Service sends an administrative SMS if new system joins..
- Extending DHCP to include TFTP and PXE services




- A/N.