Running a DHCP Server


The software required for running a DHCP server is not built into FreeBSD. Third-party packages for performing this duty are, however, available in the ports or packages; probably the most popular and full-featured is the ISC DHCP server package, a "reference implementation" suite of tools written by the same folks who brought us BIND. The port, called isc-dhcp3-server, is available in the net directory of the ports tree. See Chapter 16, "Installing Additional Software," for information on how to install ports.

When isc-dhcp3 is installed, it creates a startup file in /usr/local/etc/rc.d called isc-dhcpd.sh. The next time you restart your system, this file will cause the DHCP server to start automatically on system boot. Before you do so, however, you need to set up your dhcpd.conf file to suit the needs of your system.

It's probably not a good idea to simply rename the default /usr/local/etc/dhcpd.conf.sample to dhcpd.conf and hope for the best. The sample file contains a large number of example configurations intended to demonstrate the proper syntax for each of several possible network environments. If you just enable the file as-is, you'll be setting up a configuration that has no bearing on reality.

Instead, create a brand-new dhcpd.conf file and use dhcpd.conf.sample as a guide to tell you how to set up your DHCP network according to your specific needs. For example, first you should decide whether you want to restrict DHCP service only to certain subnets, how you want to define the pool of available IP addresses, and so on. Then look in the sample configuration file for example settings that meet your needs.

The contents of dhcpd.conf consist of option statements that can be placed inside a configuration block that applies to a certain group of clients (such as a subnet), or outside all blocks so as to apply to all clients. You should begin the file with options that you want to apply to all clients that contact the server:

option domain-name "example.com"; option domain-name-servers ns1.example.com, ns2.example.com; default-lease-time 600; max-lease-time 7200; ddns-update-style ad-hoc;


Note

Statements that begin with the option keyword specify configuration information that gets passed directly to the client as part of the DHCP protocol. Statements without the option prefix are commands that control the behavior of the DHCP server itself, such as defining how the lease behavior works or specifying the valid range of IP addresses.


You'll then need at least one subnet declaration, which defines the network on which the DHCP server lives and what addresses to assign to hosts within that network. This is where you'll put statements such as range (which defines the pool of available IP addresses) and option routers (which is by its nature a subnet-specific configuration option, specifying the router that commands the network in question).

subnet 64.41.131.32 netmask 255.255.255.224 {   range 64.41.131.40 64.41.131.63;   option routers 64.41.131.162; }


You can also put options such as default-lease-time into subnet blocks; these more specific definitions override the global settings for the subnets in which they appear.

There are a great many more configuration options available, which you might find necessary depending on the complexity of your network. Consult the man dhcpd page and the examples in dhcpd.conf.sample for guidance on these more specialized configurations.




FreeBSD 6 Unleashed
FreeBSD 6 Unleashed
ISBN: 0672328755
EAN: 2147483647
Year: 2006
Pages: 355
Authors: Brian Tiemann

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net