1.安装:
sudo apt-get install isc-dhcp-server
2.ifconfig -a命令查看网卡信息
ifconfig -a
docker0 Link encap:以太网 硬件地址 02:42:ec:d0:50:85
inet 地址:172.17.0.1 广播:172.17.255.255 掩码:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 跃点数:1
接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:0
接收字节:0 (0.0 B) 发送字节:0 (0.0 B)
enp0s31f6 Link encap:以太网 硬件地址 8c:16:45:4a:23:d9
BROADCAST MULTICAST MTU:1500 跃点数:1
接收数据包:0 错误:0 丢弃:0 过载:0 帧数:0
发送数据包:0 错误:0 丢弃:0 过载:0 载波:0
碰撞:0 发送队列长度:1000
接收字节:0 (0.0 B) 发送字节:0 (0.0 B)
中断:16 Memory:ec200000-ec220000
3.配置ipv6 静态ip:
sudo ifconfig enp0s31f6 inet6 add 2003:db8:0:1::1/64
4.修改dhcp6配置文件
sudo gedit /etc/dhcp/dhcpd6.conf
cat /etc/dhcp/dhcpd6.conf
default-lease-time 600;
max-lease-time 7200;
log-facility local7;
subnet6 2003:db8:0:1::/64 {
# Range for clients
range6 2003:db8:0:1::129 2003:db8:0:1::254;
# Range for clients requesting a temporary address
range6 2003:db8:0:1::/64 temporary;
# Additional options
option dhcp6.name-servers fec0:0:0:1::1;
option dhcp6.domain-search "domain.example";
# Prefix range for delegation to sub-routers
prefix6 2003:db8:0:100:: 2003:db8:0:f00:: /56;
# Example for a fixed host address
host specialclient {
host-identifier option dhcp6.client-id 00:01:00:01:4a:1f:ba:e3:60:b9:1f:01:23:45;
fixed-address6 2003:db8:0:1::127;
}
}
5.启动isc-dhcp-server
sudo /etc/init.d/isc-dhcp-server start
注:
开启ipv6转发(某些情况需要这个配置)
修改/etc/sysctl.conf中,net.ipv6.conf.all.forwarding = 1
运行sysctl -p,使配置生效