HOWTO setup a small server
DHCP3 (Dynamic Host Configuration Protocol Server)
Installation
The installation of the Internet Software Consortium (ISC) DHCP server is performed by:
# apt-get install dhcp3-server
As there is no default configuration for any subnet in the configuration file from the package, the server's start-up during the installation process will fail. This failure will be reported to syslog and may be ignored.
Basic Configuration
The DHCP service by default listens on all network interfaces. It can be restricted to only some interfaces by listing them in:
Excerpt: /etc/default/dhcp3-server
INTERFACES="eth0"
The configuration file of the DCHP server begins with global parameters followed by subnet/host/...-specific declarations. If the DHCP server is the official server on the network, you shall uncomment that directive in the global parameters:
Excerpt: /etc/dhcp3/dhcpd.conf
authoritative;
The declaration(s) for the subnet(s) with DHCP service can be based on this snippet:
Excerpt: /etc/dhcp3/dhcpd.conf
subnet 223.1.2.0 netmask 255.255.255.0 { range 223.1.2.100 223.1.2.200; option domain-name-servers 223.1.2.1; option domain-name "example.com"; option routers 223.1.2.254; option broadcast-address 223.1.2.255; option subnet-mask 255.255.255.0; }
In constrast, you may (but need not) explicitly disable the DHCP service for a subnet, if the braces are left empty:
Excerpt: /etc/dhcp3/dhcpd.conf
subnet 223.1.2.0 netmask 255.255.255.0 { }
DHCP Boot Configuration
The DHCP server can also deliver information for clients booting via the
network. The next statements tell the client to load the file /root/path/to/filename
from the server
223.1.2.1 (for example, via TFTP). The statements
should be added to the parameters inside a subnet (or similar) declaration.
Excerpt: /etc/dhcp3/dhcpd.conf
next-server 223.1.2.1; option root-path "/root/path"; filename "/to/filename";
Client Specific Configuration
You can specify group- or host-specific parameters with group
or host
, respectively. For example,
client1
,
client2
, and
client3
are identified by their MAC
addresses and can be passed (special) boot files:
Excerpt: /etc/dhcp3/dhcpd.conf
group { # group-specific parameters (e.g., boot files) next-server 223.1.2.1; option root-path "/root/path"; filename "/client123/filename"; host client1 { hardware ethernet 0:c0:c3:49:2b:57; } host client2 { hardware ethernet 0:c0:c3:80:fc:32; } host client3 { hardware ethernet 0:c0:c3:22:46:81; } }
Finally, the server must be (re)started:
# /etc/init.d/dhcp3-server restart
Networking Requirements
Prerequisite: Shorewall The DHCP client and server
communicate via UDP on ports 68 (client side) and 67 (server side). DHCP
traffic can be permitted in file /etc/shorewall/interfaces
: Make
sure the dhcp
option is appended to the option lists of the zones
for which the DHCP service should be available.
And finally, restart Shorewall:
# shorewall restart