IPv6 DHCP configuration with CentOS 7 as DHCP server and Mikrotik as DHCPv6 client.
Note: Assumed you already have configured an IPv6 from subnet on server interface. You may follow this guide.
Subnet: 2000:5a40:0:12::/64 Gateway IP: 2000:5a40:0:12::1/64 Subnet Range: 2000:5a40:0:12::100-200
- Verify that, DHCP package is installed
# yum list installed | grep dhcp
dhcp.x86_64 12:4.2.5-68.el7.centos.1 @updates
dhcp-common.x86_64 12:4.2.5-68.el7.centos.1 @updates
dhcp-libs.x86_64 12:4.2.5-68.el7.centos.1 @updates
If not installed, you may install via yum
# yum install -y dhcp
2. Edit configuration file and restart service
# vi /etc/dhcp/dhcpd6.conf default-lease-time 3600; # 1 hour max-lease-time 86400; # 1 day authoritative; allow leasequery; dhcpv6-lease-file-name “/var/lib/dhcpd/dhcpd6.leases”; subnet6 2000:5a40:0:12::/64 { #any of following range declaration format is supported #range6 2000:5a40:0:12::100 2000:5a40:0:12::200; range6 2000:5a40:0:12::100/120; option dhcp6.name-servers 2001:4860:4860::8888; option dhcp6.domain-search "jalam.me"; } # systemctl start dhcpd6 # systemctl enable dhcpd6
3. Mikrotik client configuration
IPv6 is disabled on Mikrotik by default.
If disable enable the package and reboot the router
configuration on Mikrotik
[admin@Mikrotik] > /ipv6 dhcp-client add interface=ether2 request=address
4. verification
on Mikrotik
[admin@Mikrotik] > /ipv6 dhcp-client print Flags: D - dynamic, X - disabled, I - invalid # INTERFACE STATUS REQUEST PREFIX ADDRESS 0 ether2 bound address 2000:5a40:0:12::1d6, 51m45s [admin@Mikrotik] > /ipv6 address print Flags: X - disabled, I - invalid, D - dynamic, G - global, L - link-local # ADDRESS FROM-POOL INTERFACE ADVERTISE 0 DL fe80::e97:42ff:fef5:7a00/64 ether1 no 1 DL fe80::e97:42ff:fef5:7a02/64 ether3 no 2 DL fe80::e97:42ff:fef5:7a03/64 ether4 no 3 DL fe80::e97:42ff:fef5:7a01/64 ether2 no 4 DG 2401:5a40:0:12::1d6/64 ether2 no [admin@Mikrotik] > ping 2401:5a40:0:12::1 count=1 SEQ HOST SIZE TTL TIME STATUS 0 2401:5a40:0:12::1 56 64 3ms echo reply sent=1 received=1 packet-loss=0% min-rtt=3ms avg-rtt=3ms max-rtt=3ms
on server
# cat /var/lib/dhcpd/dhcpd6.leases
# The format of this file is documented in the dhcpd.leases(5) manual page.
# This lease file was written by isc-dhcp-4.2.5
server-duid "\000\001\000\001\"\265\204\217\000\014)\\f\025";
ia-na "\002\000\000\000\000\003\000\001\014\227B\365z\000" {
cltt 5 2018/06/15 10:42:22;
iaaddr 2000:5a40:0:12::1d6 {
binding state active;
preferred-life 2250;
max-life 3600;
ends 5 2018/06/15 11:42:22;
}
}
References:
- https://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/ch22s06.html
- https://wiki.mikrotik.com/wiki/Manual:IPv6/DHCP_Client
[…] IPv6 link local address generate automatically if IPv6 package is enabled. For enabling IPv6 you may follow this post […]