IPv6 DHCP Server (DHCPv6) in RouterOS: Configuration Guide
IPv6 DHCP Server (DHCPv6) in RouterOS: Configuration Guide
Section titled “IPv6 DHCP Server (DHCPv6) in RouterOS: Configuration Guide”Overview
Section titled “Overview”The DHCPv6 server in MikroTik RouterOS enables automatic IPv6 resource distribution to clients. It supports two primary modes:
- Prefix Delegation (DHCPv6-PD): Delegates IPv6 prefixes to downstream routers, which then distribute addresses to their networks via SLAAC or their own DHCPv6 server
- Stateful Address Assignment: Assigns individual IPv6 addresses (/128) directly to clients
DHCPv6 is commonly used by ISPs to delegate prefixes to customer routers, or in enterprise environments where centralized address management is required.
Key concept: DHCPv6 does NOT provide default gateway information. Clients receive their default gateway through Router Advertisements (RA), which must be configured separately using Neighbor Discovery (/ipv6 nd).
Prerequisites
Section titled “Prerequisites”Before configuring the DHCPv6 server:
-
Enable the IPv6 package:
/system package enable ipv6/system reboot -
Verify package is active:
/system package print where name=ipv6 -
Have an IPv6 address block to distribute:
- Your own IPv6 allocation (from RIR or ISP)
- A prefix delegated from your upstream provider
How DHCPv6 Server Works
Section titled “How DHCPv6 Server Works”┌─────────────────────────────────────────────────────────────────────┐│ Your MikroTik Router ││ ││ IPv6 Pool ──────────────────▶ DHCPv6 Server ◀──── ND/RADVD ││ (2001:db8::/48) (Prefix/Address) (Gateway via RA) │└─────────────────────────────────────────────────────────────────────┘ │ │ │ Prefix: 2001:db8:1::/60 │ Gateway: fe80::1 ▼ ▼┌─────────────────────────────────────────────────────────────────────┐│ Downstream Router (Client) ││ ││ DHCPv6 Client ──▶ IPv6 Pool ──▶ LAN Addresses (SLAAC) ││ (Receives /60) (From /60) (Assigns /64s to clients) │└─────────────────────────────────────────────────────────────────────┘Menu Reference
Section titled “Menu Reference”| Menu | Purpose |
|---|---|
/ipv6 dhcp-server | DHCPv6 server configuration |
/ipv6 dhcp-server binding | View/manage client bindings |
/ipv6 pool | IPv6 address pools for delegation |
/ipv6 nd | Neighbor Discovery (Router Advertisements) |
Configuration Properties
Section titled “Configuration Properties”DHCPv6 Server Properties
Section titled “DHCPv6 Server Properties”| Property | Type | Default | Description |
|---|---|---|---|
name | string | - | Server identifier (required) |
interface | string | - | Interface to serve DHCPv6 (required) |
address-pool | string | - | Pool for address assignment (/128 prefixes) |
prefix-pool | string | - | Pool for prefix delegation |
lease-time | time | 3d | How long clients can use assigned resources |
preference | integer:0-255 | - | Server priority (higher = preferred) |
rapid-commit | yes/no | yes | Enable two-message exchange (faster) |
route-distance | integer | - | Distance for routes to DHCPv6 clients |
use-radius | no/yes/accounting | no | RADIUS integration for authentication/accounting |
disabled | yes/no | no | Enable/disable server |
IPv6 Pool Properties
Section titled “IPv6 Pool Properties”| Property | Type | Default | Description |
|---|---|---|---|
name | string | - | Pool identifier (required) |
prefix | IPv6 prefix | - | Parent prefix to allocate from |
prefix-length | integer:1-128 | - | Size of delegated prefixes (e.g., 64 for /64s) |
Binding Properties
Section titled “Binding Properties”| Property | Type | Description |
|---|---|---|
address | IPv6 prefix | Assigned prefix or address |
duid | hex string | Client’s unique identifier |
iaid | integer | Identity Association Identifier |
server | string | DHCPv6 server name |
status | enum | waiting, offered, or bound |
rate-limit | rx/tx | Bandwidth limit for this binding |
Configuration Examples
Section titled “Configuration Examples”Example 1: Prefix Delegation for Downstream Routers
Section titled “Example 1: Prefix Delegation for Downstream Routers”Delegate /60 prefixes from a /48 block to customer routers:
# Step 1: Create IPv6 pool for prefix delegation/ipv6 pool add name=customer-pool prefix=2001:db8::/48 prefix-length=60
# Step 2: Create DHCPv6 server for prefix delegation/ipv6 dhcp-server add name=dhcpv6-pd interface=ether2-customers \ prefix-pool=customer-pool lease-time=1d
# Step 3: Verify server is running/ipv6 dhcp-server printExpected output:
# NAME INTERFACE ADDRESS-POOL PREFIX-POOL LEASE-TIME 0 dhcpv6-pd ether2-customers customer-pool 1dNote: The server automatically installs routes to assigned prefixes in the routing table.
Example 2: Stateful Address Assignment
Section titled “Example 2: Stateful Address Assignment”Assign individual IPv6 addresses to clients (useful when SLAAC is not desired):
# Step 1: Create pool with /128 prefix-length for addresses/ipv6 pool add name=address-pool prefix=2001:db8:100::/64 prefix-length=128
# Step 2: Create DHCPv6 server for address assignment/ipv6 dhcp-server add name=dhcpv6-addr interface=bridge-lan \ address-pool=address-pool lease-time=12h
# Step 3: Configure ND to tell clients to use DHCPv6 for addresses/ipv6 nd set [find interface=bridge-lan] managed-address-configuration=yes
# Step 4: Optionally disable SLAAC (autonomous addressing)/ipv6 nd prefix set [find interface=bridge-lan] autonomous=noExample 3: Combined Address and Prefix Delegation
Section titled “Example 3: Combined Address and Prefix Delegation”Provide both addresses and prefixes to clients:
# Step 1: Create pools/ipv6 pool add name=addr-pool prefix=2001:db8:1::/64 prefix-length=128/ipv6 pool add name=prefix-pool prefix=2001:db8:2::/48 prefix-length=60
# Step 2: Create DHCPv6 server with both pools/ipv6 dhcp-server add name=dhcpv6-full interface=ether2 \ address-pool=addr-pool prefix-pool=prefix-pool lease-time=1dExample 4: DHCPv6 Server on PPPoE
Section titled “Example 4: DHCPv6 Server on PPPoE”Delegate prefixes to PPPoE clients using PPP profiles:
# Step 1: Create IPv6 pool/ipv6 pool add name=pppoe-pd-pool prefix=2001:db8::/48 prefix-length=60
# Step 2: Create PPP profile with DHCPv6-PD enabled/ppp profile add name=pppoe-ipv6 local-address=pool-pppoe \ dhcpv6-pd-pool=pppoe-pd-pool
# Step 3: Create PPPoE server using the profile/interface pppoe-server server add interface=ether1 \ default-profile=pppoe-ipv6 service-name=pppoe-serviceNote: PPP automatically creates a dynamic DHCPv6-PD server when clients connect.
Example 5: Static Binding for Specific Client
Section titled “Example 5: Static Binding for Specific Client”Reserve a specific prefix for a known client:
# Step 1: Find client's DUID from current bindings/ipv6 dhcp-server binding print detail
# Step 2: Convert dynamic binding to static/ipv6 dhcp-server binding make-static [find duid=0x00010001...]
# Step 3: Or create static binding manually/ipv6 dhcp-server binding add server=dhcpv6-pd \ duid=0x00010001abcd1234 address=2001:db8:1::/60Example 6: Rate Limiting DHCPv6 Clients
Section titled “Example 6: Rate Limiting DHCPv6 Clients”Limit bandwidth per client binding:
# Step 1: Convert binding to static/ipv6 dhcp-server binding make-static [find duid=0x00010001...]
# Step 2: Set rate limit (rx/tx in bits per second)/ipv6 dhcp-server binding set [find duid=0x00010001...] \ rate-limit=10M/5M
# Step 3: Enable dual-stack queue (optional, combines IPv4/IPv6)/ipv6 dhcp-server set [find] allow-dual-stack-queue=yesExample 7: Binding Script for Automation
Section titled “Example 7: Binding Script for Automation”Execute a script when bindings change:
/ipv6 dhcp-server add name=dhcpv6-pd interface=ether2 \ prefix-pool=customer-pool script={ :if ($bindingBound = 1) do={ :log info "DHCPv6: Prefix $bindingPrefix bound to $bindingDUID" } else={ :log warning "DHCPv6: Prefix released by $bindingDUID" } }Available script variables:
| Variable | Description |
|---|---|
bindingBound | 1 = bound, 0 = unbound |
bindingServerName | DHCPv6 server name |
bindingDUID | Client’s DUID |
bindingAddress | Assigned address (if applicable) |
bindingPrefix | Delegated prefix (if applicable) |
Understanding Prefix Length in Pools
Section titled “Understanding Prefix Length in Pools”The prefix-length property determines what size prefixes are delegated:
| Pool Prefix | prefix-length | Result | Available Prefixes |
|---|---|---|---|
| /48 | 60 | Delegates /60s | 4,096 clients |
| /48 | 56 | Delegates /56s | 256 clients |
| /48 | 52 | Delegates /52s | 16 clients |
| /56 | 60 | Delegates /60s | 16 clients |
| /56 | 64 | Delegates /64s | 256 clients |
| /64 | 128 | Assigns addresses | 18 quintillion addresses |
Example: ISP with /32 allocating /56 per customer:
/ipv6 pool add name=isp-pool prefix=2001:db8::/32 prefix-length=56# Result: 16 million /56 prefixes availableCommon Problems and Solutions
Section titled “Common Problems and Solutions”Problem 1: Clients Not Receiving Prefixes
Section titled “Problem 1: Clients Not Receiving Prefixes”Symptom: DHCPv6 server is running but clients stay in “searching” state.
Causes:
- Firewall blocking UDP port 547 (server) or 546 (client)
- Wrong interface specified
- Pool exhausted
Solutions:
# Add firewall rule for DHCPv6 server/ipv6 firewall filter add chain=input dst-port=547 protocol=udp \ action=accept comment="Allow DHCPv6 server"
# Verify interface is correct/ipv6 dhcp-server print
# Check pool usage/ipv6 pool used printProblem 2: Routes Not Installed for Delegated Prefixes
Section titled “Problem 2: Routes Not Installed for Delegated Prefixes”Symptom: Server delegates prefix but traffic doesn’t route to client.
Cause: Route installation disabled or distance too high.
Solution:
# Check if routes are being installed/ipv6 route print where dynamic
# Set appropriate route distance/ipv6 dhcp-server set [find] route-distance=1Problem 3: Clients Cannot Reach Internet
Section titled “Problem 3: Clients Cannot Reach Internet”Symptom: Client receives prefix but has no connectivity.
Cause: Client not receiving default gateway (Router Advertisements disabled).
Solution:
# On the DHCPv6 server side - ensure ND is configured/ipv6 nd print# Should show interface with RA enabled
# On client side - ensure RA acceptance is enabled/ipv6 settings set accept-router-advertisements=yesProblem 4: Binding Shows “waiting” Indefinitely
Section titled “Problem 4: Binding Shows “waiting” Indefinitely”Symptom: Static binding never transitions to “bound” status.
Causes:
- Incorrect DUID format
- Client not requesting resources
- IAID mismatch
Solution:
# Verify DUID from working dynamic binding first/ipv6 dhcp-server binding print detail where status=bound
# Match DUID format exactly (include 0x prefix)/ipv6 dhcp-server binding set [find] duid=0x00010001...Problem 5: Pool Runs Out of Prefixes
Section titled “Problem 5: Pool Runs Out of Prefixes”Symptom: “no free prefixes” error, new clients cannot connect.
Solutions:
# Check pool usage/ipv6 pool used print
# Remove stale bindings/ipv6 dhcp-server binding remove [find status!=bound]
# Reduce lease time to reclaim prefixes faster/ipv6 dhcp-server set [find] lease-time=4h
# Or expand pool if possibleDHCPv6 Server vs SLAAC
Section titled “DHCPv6 Server vs SLAAC”| Aspect | DHCPv6 Server | SLAAC (ND) |
|---|---|---|
| Address Source | Central server | Client generates from prefix |
| Management | Centralized, trackable bindings | Decentralized, harder to track |
| Prefix Delegation | Supported | Not applicable |
| Best For | ISPs, large networks | Home/small office |
| Logging | Full binding history | Limited (neighbor table) |
| Configuration | More complex | Simple (advertise=yes) |
Verification Commands
Section titled “Verification Commands”# Check DHCPv6 server status/ipv6 dhcp-server print
# View all bindings/ipv6 dhcp-server binding print
# View binding details/ipv6 dhcp-server binding print detail
# Check pool allocation/ipv6 pool print/ipv6 pool used print
# Verify routes to delegated prefixes/ipv6 route print where dynamic
# Check ND configuration/ipv6 nd print
# Force client reconfiguration (if supported)/ipv6 dhcp-server binding send-reconfigure [find]Firewall Considerations
Section titled “Firewall Considerations”DHCPv6 uses UDP ports:
- 546: Client port
- 547: Server port
# Allow DHCPv6 server traffic/ipv6 firewall filter add chain=input protocol=udp dst-port=547 \ action=accept comment="DHCPv6 server" place-before=0
# Allow DHCPv6 client responses (if router is also a client)/ipv6 firewall filter add chain=input protocol=udp dst-port=546 \ action=accept comment="DHCPv6 client" place-before=0Related Topics
Section titled “Related Topics”Prerequisites
Section titled “Prerequisites”- IPv6 Addresses - server interface must have IPv6 address
Related IPv6 Services
Section titled “Related IPv6 Services”- IPv6 Neighbor Discovery - SLAAC (alternative to DHCPv6)
- IPv6 DHCP Client - obtain prefix from ISP
- IPv6 Firewall - allow UDP 546/547
IPv4 Equivalent
Section titled “IPv4 Equivalent”- DHCP Server - IPv4 DHCP configuration
- DHCP Relay - IPv4 DHCP relay
Related Topics
Section titled “Related Topics”- RADIUS - authentication and accounting
Summary
Section titled “Summary”The RouterOS DHCPv6 server provides:
- Prefix Delegation: Delegate blocks of addresses to downstream routers
- Address Assignment: Assign individual addresses to clients
- RADIUS Integration: Optional authentication and accounting
- Rate Limiting: Per-client bandwidth control
Key points:
- Create IPv6 pools first, then reference them in the server configuration
prefix-lengthin pools determines the size of delegated prefixes- DHCPv6 does NOT provide default gateway - configure ND separately
- Use
managed-address-configuration=yesin ND to signal clients to use DHCPv6 - Static bindings allow reservations for specific clients
- Routes to delegated prefixes are installed automatically