Setting up a DHCP server
This is a guide to the (hopefully) succesful configuration and usage of the DHCP server distributed with the OpenBSD base install.
Follow these pointers:
- Edit
/etc/rc.conf.localto start the DHCP server automatically:dhcpd_flags="-q" # for normal use: "-q"
- Create/edit the file
/etc/dhcpd.confto configuredhcpd:# $OpenBSD: dhcpd.conf,v 1.1 1998/08/19 04:25:45 form Exp $
#
# DHCP server options.
# See dhcpd.conf(5) and dhcpd(8) for more information.shared-network LOCAL-NET {
option routers 10.0.0.3;
option domain-name "intranet.atomicvoid.net";
option domain-name-servers 10.0.0.3;subnet 10.0.0.0 netmask 255.255.255.0 {
range 10.0.0.100 10.0.0.200;
}host miranda {
hardware ethernet 00:00:39:3b:68:0d;
fixed-address miranda.intranet.atomicvoid.net;
}host andromeda {
hardware ethernet 00:50:fc:0c:3e:32;
fixed-address andromeda.intranet.atomicvoid.net;
}
}
For a more detailed working example, see my dhcpd.conf file.The “host” directives inform the DHCP server to allocate a “fixed-address” to requests with a MAC address equal to the one listed by “hardware ethernet”.
The “subnet” directive informs the DHCP server that all DHCP requests result in a allocation of an IP address in the range of [10.0.0.100 - 10.0.0.200] if a client’s MAC address is not listed by one of the “host” directives. - Create/edit the file
/etc/dhcpd.interfacesto list the interfacesdhcpdshould listen on for DHCP requests:# $OpenBSD: dhcpd.interfaces,v 1.1 1998/08/19 04:25:45 form Exp $
#
# List of network interfaces served by dhcpd(8).
#
# ep0
# ed0 le0
# de1
xl0
In this case, only DHCP request entering via the interfacexl0will be seen and handled by the DHCP daemon. - Reboot the system to have the changes take effect. Alternately, you can execute
/usr/sbin/dhcpd -q xl0
to start the DHCP server. Option “-q” quiets the chatter of the DHCP server and “xl0″ is the interface on which the DHCP server should listen for requests. - Check
/var/log/daemonif the DHCP server was started succesfully.