To provide a highly-available service, despite server failure, two DHCP containers can be configured to run as an active/active HA pair. NS1 uses the load balancing mechanism where both DHCP services are active — each handling approximately half of the traffic. In case of a failure of either server, the partner is able to take over responding to all traffic directed to both servers.
The diagram below represents an example of an NS1 DDI deployment with highly available DHCP services configured.
Instructions
NS1 uses docker-compose.yml files to configure DDI containers. To configure DHCP high-availability, edit the Docker compose (docker-compose.yml) file for the two DHCP containers you want to configure as an active/active HA pair.
Step 1: Edit the DHCP container port mapping
A communication control channel on port TCP/5353 is needed between the two containers so that they can exchange lease updates and determine their peer's health (heartbeat). In the dhcp
heading, under ports, add the following lines to configure the port
mapping:
ports:
- "5555:5353" # Example port configuration for DHCP Failover
For example:
Do this for both DHCP containers in the active/active pair. Note that port 5555 is configurable. For more information about ports and firewall rules, refer to Default DDI Ports & Firewall Rules.
Step 2: Edit both DHCP container configurations.
In the Docker Compose file, under the same dhcp
> command
section, add the following configuration options to each container:
Parameter | Type | Description |
---|---|---|
--core_host | string (or array of strings) | IP address or hostname (or a list of IP addresses or hostnames) for the CORE or DIST container |
--dhcp_ha | boolean | Set to "true" for only one of the DHCP containers in the pair to designate it as the primary container. Adding this parameter to the load balance configuration resolves potential deadlocks between the state machines of the two servers reconnecting after a shutdown or failure. The primary server takes the lead in performing certain tasks—such as lease database synchronization—while the secondary server waits for the primary to complete this task before doing the same. |
--dhcp_peers | string | IP address and port (IP:port) of the paired DHCP container. |
--service_def_id | integer | Unique identifier for the service definition. This must be the same for both DHCP containers in the HA pair. |
For example:
Step 3: Restart both DHCP containers in the active-active pair.
Execute the command below on each DHCP container to force a service restart. Once both DHCP containers (services) are restarted, the HA configuration goes into effect.
docker-compose -p ddi -f docker-compose.yml up -d
Once complete, a success message (done
)appears to indicate the restart is complete.