Chapter 5: DHCP Services

5.1. Overview

Dynamic Host Configuration Protocol (DHCP) is a protocol that allows network administrators to automatically assign IP numbers to computers on a network. It can perform this function both for IPv4 and IPv6 addresses.

IP Address Assignment

A DHCP Server implements the task of assigning IP addresses to DHCP clients. These addresses come from a predefined IP address pool which DHCP manages. When a DHCP server receives a request from a DHCP client, it returns the configuration parameters (such as an IP address, a MAC address, a domain name, and a lease for the IP address) to the client in a unicast message.

DHCP Leases

Compared to static assignment, where the client owns the address, dynamic addressing by a DHCP server leases the address to each client for a predefined period of time. During the lifetime of a lease, the client has permission to keep the assigned address and is guaranteed to have no address collision with other clients.

Lease Expiration

Before the expiration of the lease, the client needs to renew the lease from the server so it can keep using the assigned IP address. The client may also decide at any time that it no longer wishes to use the IP address it was assigned, and may terminate the lease and release the IP address. The lease time can be configured in a DHCP server by the administrator.

cOS Core Can Be DHCP Client, Server or Relayer

cOS Core can perform the following roles with DHCP:

  • DHCP Client

    cOS Core interfaces can be configured to be a DHCP client for either IPv4 or IPv6. This means that they can receive DHCP leases from an external DHCP server. The most common usage of this feature is when an interface is connected to an ISP for public Internet access and the cOS Core address book is populated with the public IP address for the interface as well as IP addresses for public DNS servers.

    DHCP client setup is discussed further in Section 5.2, IPv4 DHCP Client and Section 5.6.1, DHCPv6 Client.

  • DHCP Server

    cOS Core interfaces can be configured to be a DHCP server for either IPv4 or IPv6. This means that they can allocate DHCP leases to connecting DHCP clients. This is often done so that protected internal clients can be allocated private IP addresses when they connect to the public Internet through the firewall, using NAT to share the connections over a single public IP address.

    DHCP server setup is discussed further in Section 5.3, IPv4 DHCP Server and Section 5.6.2, DHCPv6 Server.

  • DHCP Relayer

    It is possible to configure cOS Core so it relays DHCP traffic between an external client and an external server. This feature is discussed further in Section 5.4, IPv4 DHCP Relay.

The Ordering of DHCP Connection Can Be Important

It should be noted that the relevant IP address objects in the cOS Core address book can only be populated after an interface enabled as a DHCP client is connected to a DHCP server source such as an ISP. This may seem an obvious fact to state but it is important to keep in mind when another interface acts as a DHCP server and depends on address objects populated by the client.

For example, public DNS addresses handed out by an ISP to the firewall acting as a DHCP client might then be handed out on another interface acting as a DHCP server for connecting clients. This means the firewall should be connected to the ISP first, before the clients receiving the DNS addresses are connected. Otherwise, the clients may need to disconnect and then reconnect to get a DHCP lease with the DNS addresses.