Installation

This access point must provide the wireless devices with an IP address. To do so we must install a DHCP server. We will install isc-dhcp-server.

Note: Do not install dnsmasq because it does not get along with bind. If you remember, we are also using our server as a DNS server for all the hosts in the Local Area Network, and we are using bind for that purpose.

_$: apt-get install isc-dhcp-server

Configuration

/etc/default/isc-dhcp-server:
-----------------------------
# Defaults for dhcp initscript
# sourced by /etc/init.d/dhcp
# installed at /etc/default/isc-dhcp-server by the maintainer scripts

#
# This is a POSIX shell fragment
#

# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
#	Separate multiple interfaces with spaces, e.g. "eth0 eth1".
INTERFACES="wlan0"
/etc/dhcp/dhcpd.conf:
---------------------
...
ddns-update-style none;
...
# option domain-name "example.org";
# option domain-name-servers ns1.example.org, ns2.example.org;

# default-lease-time 600;
# max-lease-time 7200;
...
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
authoritative;
...
subnet 192.168.2.0 netmask 255.255.255.0 {
    range 192.168.2.10 192.168.2.20;
    option domain-name-servers 192.168.2.101;
    option routers 192.168.2.101;
}

Let’s see if the configuration is right:

_$: dhcpd -t
_$: service isc-dhcp-server start
_$: service isc-dhcp-server status
isc-dhcp-server start/running, process 14179

Leases

The files for the leases are by default in /var/lib/dhcp.

Apparmor

Some permission issues might arise with isc-dhcp-server because of apparmor. Let’s check if apparmor is configured for isc-dhcp-server:

_$: apparmor_status | grep dhcpd
   /usr/sbin/dhcpd
   /usr/sbin/dhcpd (14179)

It is, so check the permissions:

/etc/apparmor.d/usr.sbin.dhcpd:
-------------------------------
/usr/sbin/dhcpd {
  ...
  /etc/dhcp/ r,
  /etc/dhcp/** r,
  /etc/dhcpd{,6}.conf r,
  /etc/dhcpd{,6}_ldap.conf r,

  /usr/sbin/dhcpd mr,

  /var/lib/dhcp/dhcpd{,6}.leases* lrw,
  /var/log/ r,
  /var/log/** rw,
  /{,var/}run/{,dhcp-server/}dhcpd{,6}.pid rw,
  ...
}

If you still have problems with apparmor check https://help.ubuntu.com/community/isc-dhcp-server.