DHCP Server Installation

From Scottworld
Jump to navigation Jump to search

We will now set up a DHCP Server and configure it to hand out a specific range of addresses and update DNS (once we set it up)

Install the DHCP server package.

sudo apt-get install isc-dhcp-server

It will fail on startup as it is not configured yet.

service isc-dhcp-server stop

Configure the interface to listen on

nano /etc/default/isc-dhcp-server

Change the parameter for "interfaces"

INTERFACES="br0" (in our case we use br0 as we are using a bridge)

Configure /etc/dhcp/dhcpd.conf

nano /etc/dhcp/dhcpd.conf

The following sample config file sets up the following parameters.

  • Hands out IP addresses in the range
  • Sets the following clients default settings
    • default router =
    • domain-name-servers,;
    • domain-name "scottworld.net";
    • routers;
    • broadcast-address;
    • It reserves a number of addresses by mac address for certain devices / hosts.

Its will also attempt to dynamically update DNS with new clients. (When we configure it)

# The ddns-updates-style parameter controls whether or not the server will
# attempt to do a DNS update when a lease is confirmed. We default to the
# behavior of the version 2 packages ('none', since DHCP v2 didn't
# have support for DDNS.)
ddns-updates on;
ddns-update-style standard;
allow unknown-clients;
use-host-decl-names on;

# Definition of RFC 4833 Timezone Options

option tz-posix-string code 100 = string;
option tz-database-string code 101 = string;

# option definitions common to all supported networks...
option domain-name "scottworld.net";
option ntp-servers;
option time-servers;
option time-offset 0;
option tz-database-string "Europe/London";
option tz-posix-string "GMT0BST,M3.5.0/01:00,M10.5.0/01:00";
option domain-name-servers;

default-lease-time 14400;
max-lease-time 86400;

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

# 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;

# Scottworld DNS zones
zone scottworld.net. {

zone 3.168.192.in-addr.arpa. {

# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.

#subnet netmask {
#  range dynamic-bootp;
#  option broadcast-address;
#  option routers rtr-239-32-1.example.org;

# A slightly different configuration for an internal subnet.
subnet netmask {
        option broadcast-address;
        option routers;
        ddns-domainname "scottworld.net.";
        ddns-rev-domainname "in-addr.arpa.";

# Fixed IP addresses can also be specified for hosts.   These addresses
# should not also be listed as being available for dynamic assignment.
# Hosts for which fixed IP addresses have been specified can boot using
# BOOTP or DHCP.   Hosts for which no fixed address is specified can only
# be booted with DHCP, unless there is an address range on the subnet
# to which a BOOTP client is connected which has the dynamic-bootp flag
# set.

host saturn {
  hardware ethernet FC:AA:14:E2:72:21;

host ddhomerun {
  hardware ethernet 00:18:DD:23:17:4F;

host pi {
  hardware ethernet DC:A6:32:19:ED:C1;

Restart DHCP server and test (DNS will still be broken we need to do that next)

service isc-dhcp-server restart