发现Debian 10的系统,按照官方的教程用DHCP客户端获取IPv6地址,一直获取不到...
odhcp6c is a minimal DHCPv6 and RA-client for use in embedded Linux systems especially routers.
目录
一、安装odhcp6c
echo "deb http://httpredir.debian.org/debian experimental main" >> /etc/apt/sources.list apt-get update apt-get install odhcp6c
二、编辑interfaces文件vim /etc/network/interfaces
,添加内容
iface eno1 inet6 static address IPv6段 netmask 掩码长度 post-up odhcp6c -P 64 -c DUID串 eno1 -d post-up ip -6 a a IPv6段/掩码长度 dev eno1
IPv6段/掩码长度以及DUID串,是发工单问OneProvider客服要。
三、编辑其他文件
编辑local文件vim /etc/modprobe.d/local.conf
,修改或者添加内容
options ipv6 disable=0
编辑modules文件vim /etc/modules
,添加如下字符
ipv6
编辑sysctl文件vim /etc/sysctl.conf
,添加以下内容
net.ipv4.ip_forward=1 net.ipv4.conf.all.rp_filter=1 net.ipv4.icmp_echo_ignore_broadcasts=1 net.ipv4.conf.default.forwarding=1 net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 net.ipv6.conf.eno1.autoconf=0 net.ipv6.conf.eno1.accept_ra=2 net.ipv6.conf.default.forwarding=1 net.ipv6.conf.all.forwarding=1 net.ipv6.conf.default.proxy_ndp=1 net.ipv6.conf.all.proxy_ndp=1
四、重启服务器
reboot
ip a
会输出
blabla 2: eno1 blabla inet6 2001:xxx:xxxx:xxx::/64 scope global valid_lft forever preferred_lft forever blabla
尝试ping
ping6 ipv6.google.com PING ipv6.google.com(par10s39-in-x0e.1e100.net (2a00:1450:4007:807::200e)) 56 data bytes 64 bytes from par10s39-in-x0e.1e100.net (2a00:1450:4007:807::200e): icmp_seq=1 ttl=119 time=1.04 ms 64 bytes from par10s39-in-x0e.1e100.net (2a00:1450:4007:807::200e): icmp_seq=2 ttl=119 time=5.73 ms
五、小记
很多步骤不太确定是否必要,但用以上的步骤成功获取到IPv6。后面再好好学习下各个步骤的具体用处!
参考
1. https://documentation.online.net/en/dedicated-server/network/ipv6/prefix
2. https://www.fmqcloud.com/archives/pve.html
3. https://www.goojie.eu/23.html