Online 机器 Debian 8 系统配置 IPv6

拿Online家G口的杜甫刷蒲公英PT,刷不动… 才想起来蒲公英是IPv6 Only的PT站,而Online机器的IPv6地址不是自动分配的。

参考官方的说明,手动配置IPv6地址,踩了不少坑,总算是好了。输入 sudo ifconfig,可以看到 inet6 addr: 2001:bc8:339d::20/48 Scope:Global

1. 配置 DHCPv6 客户端
新建文件sudo vim /etc/dhcp/dhclient6.conf
输入
interface "eth0" {
send dhcp6.client-id DUID;
}

将其中DUID替换成IPv6 Blocks里面给你的那串字符00:03:00:01:4b:11:2d:61:51:9d
DUID

2. 配置 DHCPv6 客户端为自动重启
新建文件sudo /etc/systemd/system/dhclient.service
输入
[Unit]
Description = dhclient for sending DUID IPv6
Wants = network.target
Before = network.target
[Service]
Type = forking
ExecStart = /sbin/dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eth0
[Install]
WantedBy = multi-user.target
顺手开启该服务sudo systemctl enable dhclient.service

3. 配置网路端口
编辑文件sudo vim /etc/network/interfaces
增加
iface eth0 inet6 static
address 2001:0bc8:339d::20
netmask 48
gateway 2001:0bc8:339d::1

4. 重启网络
sudo systemctl restart networking
不重启的网络的话,下面开启DHCPv6客户端,第5步的测试ping不通

5. 手动启动DHCPv6客户端
dhclient -cf /etc/dhcp/dhclient6.conf -6 -P -v eth0
测试是否配置成功 ping6 ipv6.google.com
cody@sd-126441:~$ ping6 ipv6.google.com
PING ipv6.google.com(par10s28-in-x0e.1e100.net) 56 data bytes
64 bytes from par10s28-in-x0e.1e100.net: icmp_seq=1 ttl=57 time=1.54 ms
64 bytes from par10s28-in-x0e.1e100.net: icmp_seq=2 ttl=57 time=1.55 ms
64 bytes from par10s28-in-x0e.1e100.net: icmp_seq=3 ttl=57 time=1.53 ms
64 bytes from par10s28-in-x0e.1e100.net: icmp_seq=4 ttl=57 time=1.53 ms

回头写成一键脚本,要不太麻烦,改来改去…

发表评论

电子邮件地址不会被公开。 必填项已用*标注