IPv6 DHCP Client (DHCPv6) in RouterOS: A Complete Guide
IPv6 DHCP Client (DHCPv6) in RouterOS: A Complete Guide
Section titled βIPv6 DHCP Client (DHCPv6) in RouterOS: A Complete GuideβRouterOS Version: 7.x+ Difficulty: Intermediate Estimated Time: 30 minutes
Overview
Section titled βOverviewβThe IPv6 DHCP client (DHCPv6) enables automatic IPv6 address and prefix acquisition from upstream providers. Unlike IPv4 DHCP which provides addresses, gateway, and DNS together, IPv6 splits these responsibilities:
- DHCPv6 provides addresses (IA_NA) and/or prefix delegation (IA_PD)
- Router Advertisements (RA) provide the default gateway
- DNS can come from either DHCPv6 or RA
The most common use case is Prefix Delegation (DHCP-PD), where your ISP delegates a block of addresses (typically /48, /56, or /60) that you can distribute across your internal networks.
Critical concept: DHCPv6 does NOT provide default gateway information. You MUST enable Router Advertisement acceptance (accept-router-advertisements=yes) for IPv6 internet connectivity.
Prerequisites
Section titled βPrerequisitesβBefore configuring DHCPv6:
-
Enable the IPv6 package:
/system package enable ipv6/system reboot -
Verify package is active:
/system package print where name=ipv6
How IPv6 Address Assignment Works
Section titled βHow IPv6 Address Assignment Worksβββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ ISP Network ββ ββ DHCPv6 Server βββββββββββββββ Router Advertisement ββββββββββββ ββ (Prefix Delegation) (Default Gateway) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β β Prefix: 2001:db8::/56 β Gateway: fe80::1 βΌ βΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ Your MikroTik Router ββ ββ DHCPv6 Client βββΆ IPv6 Pool βββΆ LAN Addresses ββ (ether1-wan) (isp-pool) (bridge: ::1/64 from pool) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β β RA with prefix 2001:db8:0:1::/64 βΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ LAN Devices ββ (SLAAC: 2001:db8:0:1:xxxx:xxxx:xxxx:xxxx) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββMenu Reference
Section titled βMenu Referenceβ| Menu | Purpose |
|---|---|
/ipv6 dhcp-client | DHCPv6 client configuration |
/ipv6 pool | IPv6 address pools (auto-created by PD) |
/ipv6 address | IPv6 addresses (use from-pool for PD) |
/ipv6 settings | Global IPv6 settings (RA acceptance) |
Configuration Properties
Section titled βConfiguration Propertiesβ| Property | Type | Default | Description |
|---|---|---|---|
interface | string | - | WAN interface for DHCPv6 (required) |
request | prefix, address | - | What to request from server |
pool-name | string | - | Pool name to store delegated prefix |
pool-prefix-length | integer | - | Size of allocations from pool (typically 64) |
prefix-hint | IPv6 prefix | - | Preferred prefix size hint to ISP (e.g., ::/56) |
add-default-route | yes/no | no | Add default route from DHCPv6 (NOT recommended) |
use-peer-dns | yes/no | yes | Accept DNS servers from DHCPv6 |
disabled | yes/no | no | Enable/disable client |
Configuration Examples
Section titled βConfiguration ExamplesβExample 1: Basic Prefix Delegation (Most Common)
Section titled βExample 1: Basic Prefix Delegation (Most Common)βThis is the standard residential/SMB setup:
# Step 1: Enable Router Advertisement acceptance (CRITICAL)/ipv6 settings set accept-router-advertisements=yes
# Step 2: Create DHCPv6 client for prefix delegation/ipv6 dhcp-client add interface=ether1-wan request=prefix \ pool-name=isp-pool pool-prefix-length=64
# Step 3: Verify prefix received/ipv6 dhcp-client printExpected output:
# INTERFACE STATUS PREFIX 0 ether1-wan bound 2001:db8:abcd::/56# Step 4: Assign address to LAN from pool/ipv6 address add address=::1/64 from-pool=isp-pool interface=bridge advertise=yes
# Step 5: Verify default route (comes from RA, not DHCPv6)/ipv6 route print where dst-address="::/0"Expected: Route with fe80::... gateway (link-local address is normal).
Example 2: DHCPv6 over PPPoE
Section titled βExample 2: DHCPv6 over PPPoEβFor ISPs using PPPoE with IPv6:
# Step 1: Create PPPoE client/interface pppoe-client add name=pppoe-wan interface=ether1 \ user=myuser password=mypass
# Step 2: Enable RA acceptance/ipv6 settings set accept-router-advertisements=yes
# Step 3: Create DHCPv6 client on PPPoE interface/ipv6 dhcp-client add interface=pppoe-wan request=prefix \ pool-name=pppoe-pool pool-prefix-length=64
# Step 4: Assign LAN address from pool/ipv6 address add address=::1/64 from-pool=pppoe-pool interface=bridge advertise=yesExample 3: Request Both Address and Prefix
Section titled βExample 3: Request Both Address and PrefixβSome ISPs provide both a WAN address and a delegated prefix:
/ipv6 dhcp-client add interface=ether1-wan request=address,prefix \ pool-name=isp-pool pool-prefix-length=64 use-peer-dns=yesVerify both were received:
/ipv6 dhcp-client print detailLook for both address and prefix fields populated.
Example 4: Multiple VLANs from Delegated Prefix
Section titled βExample 4: Multiple VLANs from Delegated PrefixβWhen ISP provides a larger prefix (/48 or /56), distribute across VLANs:
# Step 1: Request prefix with size hint/ipv6 dhcp-client add interface=ether1-wan request=prefix \ pool-name=isp-pool pool-prefix-length=64 prefix-hint=::/56
# Step 2: Assign to multiple VLANs (each gets unique /64)/ipv6 address add address=::1/64 from-pool=isp-pool interface=vlan10 advertise=yes/ipv6 address add address=::1/64 from-pool=isp-pool interface=vlan20 advertise=yes/ipv6 address add address=::1/64 from-pool=isp-pool interface=vlan30 advertise=yes
# Step 3: Verify each VLAN got different /64/ipv6 address print where from-pool=isp-poolExample 5: Custom DNS (Ignore ISP DNS)
Section titled βExample 5: Custom DNS (Ignore ISP DNS)β/ipv6 dhcp-client add interface=ether1-wan request=prefix \ pool-name=isp-pool pool-prefix-length=64 use-peer-dns=no
# Set custom DNS/ip dns set servers=2606:4700:4700::1111,2606:4700:4700::1001Example 6: DHCPv6 Status Change Script
Section titled βExample 6: DHCPv6 Status Change ScriptβExecute a script when prefix is acquired or lost:
/ipv6 dhcp-client add interface=ether1-wan request=prefix \ pool-name=isp-pool pool-prefix-length=64 script={ :if ($"pd-valid" = 1) do={ :log info "DHCPv6: Prefix acquired: $\"pd-prefix\"" # Add custom actions here } else={ :log warning "DHCPv6: Prefix lost!" # Add recovery actions here } }Available script variables:
| Variable | Description |
|---|---|
pd-valid | 1 = prefix valid, 0 = prefix removed |
pd-prefix | The delegated prefix (e.g., 2001:db8::/56) |
na-valid | 1 = address valid, 0 = address removed |
na-address | The assigned IPv6 address |
Example 7: Firewall Rule for DHCPv6 Client
Section titled βExample 7: Firewall Rule for DHCPv6 ClientβEnsure firewall allows DHCPv6 client traffic:
/ipv6 firewall filter add chain=input dst-port=546 protocol=udp \ action=accept comment="Allow DHCPv6 client" place-before=0Note: Some ISPs send DHCPv6 from global addresses (not link-local). If using a firewall rule with src-address=fe80::/10, change it to in-interface=ether1-wan instead.
Understanding pool-prefix-length vs prefix-hint
Section titled βUnderstanding pool-prefix-length vs prefix-hintβThese are commonly confused:
| Property | Purpose | Example |
|---|---|---|
prefix-hint | Tell ISP what size prefix you want | ::/56 requests a /56 |
pool-prefix-length | Size of allocations FROM the pool | 64 means pool gives out /64s |
Example: ISP gives you a /56. You want to assign /64s to each VLAN:
/ipv6 dhcp-client add interface=ether1-wan request=prefix \ pool-name=isp-pool \ prefix-hint=::/56 \ # Request /56 from ISP pool-prefix-length=64 # Allocate /64s from poolCommon Problems and Solutions
Section titled βCommon Problems and SolutionsβProblem 1: No Internet Despite βBoundβ Status
Section titled βProblem 1: No Internet Despite βBoundβ StatusβSymptom: DHCPv6 shows bound but no IPv6 connectivity.
Cause: Missing default route because Router Advertisements are disabled.
Solution:
/ipv6 settings set accept-router-advertisements=yesVerify:
/ipv6 route print where dst-address="::/0"Should show route with fe80:: gateway.
Problem 2: Client Stuck on βSearchingβ
Section titled βProblem 2: Client Stuck on βSearchingββCauses:
- Firewall blocking UDP port 546
- ISP not providing DHCPv6
- ISP device in gateway mode (not bridge)
Solutions:
# Add firewall rule/ipv6 firewall filter add chain=input dst-port=546 protocol=udp action=accept place-before=0
# Check ISP provides DHCPv6 (contact ISP)# Put ISP modem in bridge mode if possibleProblem 3: Firewall Blocks ISPβs DHCPv6 Server
Section titled βProblem 3: Firewall Blocks ISPβs DHCPv6 ServerβSymptom: DHCPv6 works on some ISPs but not others.
Cause: Default firewall rule restricts DHCPv6 to link-local sources, but some ISPs (like Comcast) use global addresses.
Solution:
# Instead of: src-address=fe80::/10# Use: in-interface=ether1-wan/ipv6 firewall filter set [find comment~"DHCPv6"] in-interface=ether1-wanProblem 4: Only One /64 Available from Large Prefix
Section titled βProblem 4: Only One /64 Available from Large PrefixβCause: pool-prefix-length not set or set incorrectly.
Solution:
/ipv6 dhcp-client set [find] pool-prefix-length=64This ensures /64s are allocated from the pool (not the entire prefix as one block).
Problem 5: add-default-route=yes Causes Issues
Section titled βProblem 5: add-default-route=yes Causes IssuesβCause: This property is a workaround that often fails.
Solution:
# Don't use add-default-route/ipv6 dhcp-client set [find] add-default-route=no
# Instead, enable RA acceptance/ipv6 settings set accept-router-advertisements=yesProblem 6: ISP DNS Still Used Despite use-peer-dns=no
Section titled βProblem 6: ISP DNS Still Used Despite use-peer-dns=noβCause: DNS may also come from Router Advertisements.
Solution: Wait for prefix renewal, or release/renew:
/ipv6 dhcp-client release [find]/ipv6 dhcp-client renew [find]DHCPv6 Client Status Values
Section titled βDHCPv6 Client Status Valuesβ| Status | Meaning |
|---|---|
bound | Successfully acquired prefix/address |
searching | Sending SOLICIT, waiting for server |
requesting | Sent REQUEST, waiting for REPLY |
renewing | Renewing lease with original server |
rebinding | Trying to rebind with any server |
stopped | Client is disabled |
error | Error occurred |
Verification Commands
Section titled βVerification Commandsβ# Check DHCPv6 client status/ipv6 dhcp-client print detail
# Verify pool was created/ipv6 pool print
# Check LAN addresses from pool/ipv6 address print where from-pool
# Verify default route (from RA)/ipv6 route print where dst-address="::/0"
# Check RA acceptance is enabled/ipv6 settings print
# Test IPv6 connectivity/ping 2001:4860:4860::8888 count=3
# Release and renew/ipv6 dhcp-client release [find]/ipv6 dhcp-client renew [find]Key Differences from IPv4 DHCP
Section titled βKey Differences from IPv4 DHCPβ| Aspect | IPv4 DHCP | IPv6 DHCPv6 |
|---|---|---|
| Default Gateway | Provided by DHCP | Provided by Router Advertisement |
| Address Assignment | Always via DHCP | Can be DHCP, SLAAC, or both |
| Prefix Delegation | Not applicable | Common feature (DHCP-PD) |
| DNS | Provided by DHCP | Can be DHCP or RA |
Related Features
Section titled βRelated Featuresβ- IPv6 Addresses (
/ipv6 address) - Usefrom-poolfor dynamic assignment - IPv6 Pools (
/ipv6 pool) - Stores delegated prefixes - IPv6 ND (
/ipv6 nd) - Configure Router Advertisements for LAN - IPv6 Firewall (
/ipv6 firewall) - Must allow UDP 546 - IPv6 Routes (
/ipv6 route) - Default route comes from RA - IPv6 Settings (
/ipv6 settings) - Enableaccept-router-advertisements
Summary
Section titled βSummaryβDHCPv6 in RouterOS is primarily used for Prefix Delegation from your ISP:
- Enable IPv6 package and reboot
- Enable RA acceptance (
accept-router-advertisements=yes) - CRITICAL - Create DHCPv6 client with
request=prefix - Assign LAN addresses using
from-pool - Verify connectivity with ping to IPv6 address
Key points:
- DHCPv6 does NOT provide default gateway - that comes from Router Advertisements
pool-prefix-length=64is typically correct for LAN allocationprefix-hintis a request to ISP (may be ignored)- Some ISPs require their modem/ONT in bridge mode for PD to work
- Link-local addresses (
fe80::) as gateways are normal in IPv6
Related Topics
Section titled βRelated TopicsβPrerequisites
Section titled βPrerequisitesβ- IPv6 Addresses - IPv6 address configuration basics
LAN Distribution
Section titled βLAN Distributionβ- IPv6 ND - configure Router Advertisements for LAN clients (SLAAC)
- IPv6 DHCP Server - serve addresses to LAN (if not using SLAAC)
- IPv6 DHCP Relay - relay DHCPv6 across network segments
Security
Section titled βSecurityβ- IPv6 Firewall - must allow UDP port 546 for DHCPv6 client
Related Topics
Section titled βRelated Topicsβ- PPPoE Client - DHCPv6 often runs over PPPoE
- DNS Server - configure IPv6 DNS servers