這是本文件的舊版!


Setup IPv6 DHCP Server on CentOS7

首先設定一組IPv6 IP在要處理DHCP的網卡上:


設定完後記得重新啟動網卡,並確認有正確配置。

[root@localhost ~]# ifconfig eno2
eno2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.68.0.6  netmask 255.255.255.0  broadcast 10.68.0.255
        inet6 fe80::1e62:126a:5e95:ff1e  prefixlen 64  scopeid 0x20<link>
        inet6 fc00::1  prefixlen 7  scopeid 0x0<global>
        ether 00:25:90:4b:6c:3f  txqueuelen 1000  (Ethernet)
        RX packets 520773  bytes 778706143 (742.6 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 61432  bytes 4300571 (4.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device memory 0xfb900000-fb91ffff

Install DHCP server:

yum install dhcp
修改IPv6 dhcp設定(/etc/dhcp/dhcpd6.conf),加入以下內容:
default-lease-time 2592000;
preferred-lifetime 604800;
option dhcp-renewal-time 3600;
option dhcp-rebinding-time 7200;
allow leasequery;
option dhcp6.info-refresh-time 21600;
dhcpv6-lease-file-name "/var/lib/dhcpd/dhcpd6.leases";
 
subnet6 fc00::/7 {
range6 fc00:0:0:0:0:0:0:10 fc00:0:0:0:0:0:0:1000;
}
重新啟動services:
systemctl restart dhcpd6.service
如果啟動有發生問題,請下systemctl status dhcpd6.service去看錯誤原因。