authcha learn

Learn / Network engineer

DHCP and MAC binding

Module 5 of 5 · 25 minutes

By the end you can

  • Explain what a MAC binding is and what it needs to be strict
  • Choose which DHCP server serves a segment
  • Turn on Kea, add a subnet and a reservation, and read leases
  • Understand the warning about unexpected DHCP servers

What a MAC binding is

A MAC binding says: this device always gets this address, and a device not on the list gets nothing from the reserved range. Authcha stores fixed MAC-to-IP assignments, called reservations, and gives them to a Kea DHCP server.

The Kea server ships with Authcha but is off until you turn it on. That is on purpose: a second DHCP server on a segment is an outage. The console lists current leases and warns about other DHCP servers answering on the segment.

The pieces

PieceWhereWhat it does
SubnetsNetwork Access → DHCP → SubnetsThe segments you serve: range, pool, gateway, DNS, lease time
ReservationsDHCP → ReservationsMAC to IP. Each is written into Kea's host table in the same transaction, so Kea sees the change at its next lookup with no reload
ObservationsDHCP → ObservationsDevices seen by an optional passive DHCP listener: MAC, fingerprint and a suggested device class. Works where another DHCP server owns the segment
KeaA container or host, optionalAnswers DHCP

Which DHCP server to use

  • One DHCP server per segment. Two on one broadcast domain hand out conflicting answers. Turn pfSense's DHCP server off on the interface where Kea runs, or run Kea on a segment pfSense does not serve.
  • Binding on the firewall's own segments: keep pfSense DHCP and add static mappings (Services, DHCP Server, the interface, DHCP Static Mappings). Authcha does not manage those.
  • A dedicated segment: put Kea on a server with a leg in that VLAN, or use a DHCP relay on the router pointing at Kea. This is what the console's reservations are for.

Run Kea

  1. Make sure no other DHCP server serves the segment.
  2. On the Authcha host: sudo authcha dhcp enable --interface eth1, where eth1 faces the segment. It creates an API token for Kea, starts the container with host networking, and Kea creates its tables on first start.
  3. In DHCP → Subnets, add the subnet with its pool and gateway. Then add reservations for devices that must keep an address.
  4. After adding or changing a subnet, run sudo authcha dhcp restart. Reservations need no restart.
  5. authcha dhcp status tells you if it runs. authcha dhcp disable stops and removes it; reservations and leases stay in the database.

Leases and rogue-server warnings

DHCP → Leases lists what Kea has handed out: address, MAC, name, subnet, time left, and whether a reservation exists for the MAC. It refreshes every ten seconds, and leases that expired more than an hour ago are hidden.

Every five minutes the Kea container sends a DHCP discover on its interface and reports each server that answers. DHCP → Servers shows this server's own addresses as ours. Any other server seen in the last 24 hours is unexpected, and a red banner says so. A home router plugged into the LAN is the usual cause. If the server belongs there (a relay, a second Kea), choose Mark expected.

This check sees only what answers a discover at that moment, on that one interface. It does not replace DHCP snooping or port security on your switches.

Making the binding strict

Reservations alone give listed devices their address, but unlisted devices still get one from the pool. To serve only listed devices, the Kea subnet must have no pool. Kea allows that, but the console's subnet form requires a pool, so today you edit the rendered kea-dhcp4.conf to remove that subnet's pools entry, and redo it after each subnet change. Pair it with 802.1X or MAB on the switch so an unlisted device is not on the network at all.

Test it

On a client in the segment:

sudo dhclient -v -r eth0; sudo dhclient -v eth0      # a reserved MAC gets exactly its address
sudo nmap --script broadcast-dhcp-discover -e eth0   # lists every DHCP server answering: you want exactly one

Check three things: the reserved device got its reserved address, an unlisted device got nothing (no pool) or a pool address (pool), and nmap shows one server.

LabHands-on

Steps 1 to 3 on the demo (viewer login demo-viewer, password Authcha-View-2026). The rest need a lab network.

  1. Open DHCP on the demo. Look at the subnets and the reservations. Find one MAC with a fixed address.
  2. Open the Observations tab and look at a device's fingerprint and suggested class.
  3. Open the Servers tab and see how ours and unexpected servers are shown.
  4. On a lab host: sudo authcha dhcp enable --interface <interface> for a segment with no other DHCP server.
  5. Add a subnet and one reservation for a test machine. Renew its lease and confirm it gets exactly the reserved address.
  6. Plug a home router into the segment. Within about five minutes find it under Servers as unexpected, then mark it expected or remove it.

Check yourselfQuiz

1Why does Authcha ship Kea switched off?
2A reservation is added in the console. Does Kea need a reload?
3How do you make a MAC binding serve only listed devices?
4Where do you see an unexpected DHCP server?
5Does the rogue-server check replace switch DHCP snooping?

Cheat sheetKeep this

  • Reservation = MAC to IP, written into Kea's host table, no reload.
  • Enable: sudo authcha dhcp enable --interface <interface>. After a subnet change: authcha dhcp restart.
  • Status: authcha dhcp status. Stop: authcha dhcp disable.
  • One DHCP server per segment. Host networking for Kea.
  • Strict binding = a subnet with no pool + 802.1X or MAB.
  • Rogue check: every 5 minutes, listed in DHCP → Servers.
  • Read more: DHCP with MAC binding.