DHCP Daemon
Updated: 02/25/2004
General Information
This guide will explain how to install and some basic configuration of the Internet Software Consortium (ISC) DHCP server. The DHCP protocal is an easy way to dynamically assign IPs over a network as well as set other options like dns servers and gateways network-wide. It can also be used to assign a static IP to a machine by using its MAC address.Requirements
Installation
The ISC DHCP daemon is already on the ports tree so it's quite simple to install.|
# # |
cd /usr/ports/net/isc-dhcp3-server make install clean; rehash |
Configuration
The first thing to do is to edit the startup script.|
# # # |
cd /usr/local/etc/rc.d/ mv isc-dhcpd.sh.sample isc-dhcpd.sh nano -w isc-dhcpd.sh |
dhcpd_options" and "dhcpd_ifaces". Under dhcpd_options, you want -q (this eliminates a terribly annoying banner every time the server's started up. Under dhcpd_ifaces, you want to list the network device you want the DHCP daemon to listen on (ex: xl0).|
# # |
cd /usr/local/etc nano -w dhcpd.conf |
|
ddns-update-style none; subnet 10.10.10.0 netmask 255.255.255.0 { range 10.10.10.40 10.10.10.100; default-lease-time 144000; max-lease-time 192000; option subnet-mask 255.255.255.0; option broadcast-address 10.10.10.255; option routers 10.10.10.10; option domain-name-servers 10.10.10.10; option domain-name "internal.lan"; option netbios-name-servers 10.10.10.10; use-host-decl-names on; host switch { hardware ethernet 00:00:00:00:00:00; fixed-address 10.10.10.1; } } |
max-lease-time is the lease time (in seconds) for an IP. The lease time is how long it'll be before the DHCP daemon cycles through and sees if the IP's currently in use and either renews the lease or frees the IP accordingly.subnet-mask is straightforward. This must match the netmask declaration at the beginning.broadcast-address must be at the end of your range. In this example, it'd be 10.10.10.255; if you're using 192.168.1.x then it'd be 192.168.1.255.routers option specifies a machine/device acting as a gateway for internet access. If you don't have any, simply delete this line and pretend it doesn't exist (like for a LAN party DHCP server without Internet access).domain-name-servers specifies DNS server IPs. This is always good to be set to some sort of DNS server, even if it's not on your internal LAN.netbios-name-servers are the WINS servers on your network if any. If you don't have any, simply delete this line and pretend it doesn't exist.use-host-decl-names simply let's me use the block below that's an example on how to designate a static IP based on a MAC address. If you don't need such a thing, simply delete it.| # | chmod 755 /usr/local/etc/rc.d/isc-dhcpd.sh |
| # | /usr/local/etc/rc.d/isc-dhcpd.sh start |
/var/db/dhcpd.leases which you can open with your favorite text editor and take a peek at any time to see what's using what on the network.Author: Kyle Symonds
ksymonds at gmail dot com