最近抢到了online 3o独服,目前网上大部分获取Ipv6的方法都是向客服提交tk,并进行一堆的设置。
这样麻烦一点倒也没事,更无语的是一堆人乱写,瞎拷贝,坑了我几个晚上。
目前有两种方法,一种是使用ipv6 slaac,还有一种是使用赠送的IPv6 Blocks。
使用ipv6 slaac
[scode type="red"]如果你使用独服开小鸡,请不要用ipv6 slaac,具体原因在下面的ipv6 blocks有详细的介绍
使用方法非常简单:
进入服务器界面,查看在服务器界面下方有这个东西:

点击
ACTIVATE IPV6 SLAAC
就会显示一个ipv6地址:

这个地址即为系统自动给你分配的地址。
关于ipv6 slaac,这里贴一下archwiki的内容:
无状态地址自动配置 (SLAAC)
在网络准备好的情况下,获取IPv6地址最简单的方法是通过“无状态地址自动配置”(SLAAC)。地址会自动由路由器给出的前缀推算出,不需要其他配置,也不需要DHCP客户端。
这个ipv6地址即为你机器的ipv6地址,无论你机器是centos还是debian甚至esxi,都是用的这个地址,并且无需你手动配置。
使用IPv6 Blocks
这个耗费了我n多天,无数精力,网上没有一篇文章提到使用ipv6 blocks要打开ipv6 slaac,最后我通过提交工单和自己的测试解决了所有人都觉得“理所当然”的问题。
在这里我要先感谢:
轻风伴梦提供他的online独服供我进行测试,节省了我等待服务器重装的时间
handsome售后群里的各位小伙伴们:提普,NMD-WSM,......
hostloc里的水贴
Online - Ian | Online - Vincent | Online - Chloé | Online - Jaroslaw 这四位客服接力解决我的问题。
I:
Hello, I ORDER A FREE /48 IPV6 BLOCK,and create subnet,i get /56,But
my debian9 can't use Ipv6 anyway.Is it my server does not have
permission to use /56 subnet?
I:
https://s2.ax1x.com/2019/11/25/MvvQgA.png
https://s2.ax1x.com/2019/11/25/Mvvd3j.png
online:
Hello,
Did you see our documentation?
https://documentation.online.net/en/dedicated-server/network/ipv6/prefix
What error message do you have?
What DUID is it? Which block?
Do you use /48 block?
I:
Hello, I don't have Google to the official documentation, so I am
using https://benzina.cn/archives/5/ my DUID is
00:03:00:01:58:f3:27:dc:3d:1d my block : 2001:bc8:2e51:100:: /56 i
creat /56 block,and i use it
I:
I restarted the network
root@FR:/home/cold# ifdown enp1s0 && ifup enp1s0
Killed old client process
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp1s0/00:08:a2:0c:5c:9c
Sending on LPF/enp1s0/00:08:a2:0c:5c:9c
Sending on Socket/fallback
DHCPRELEASE on enp1s0 to 62.210.18.5 port 67
Killed old client process
RTNETLINK answers: Cannot assign requested address
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/enp1s0/00:08:a2:0c:5c:9c
Sending on LPF/enp1s0/00:08:a2:0c:5c:9c
Sending on Socket/fallback
DHCPDISCOVER on enp1s0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on enp1s0 to 255.255.255.255 port 67 interval 17
DHCPREQUEST of 51.159.53.140 on enp1s0 to 255.255.255.255 port 67
DHCPOFFER of 51.159.53.140 from 51.159.53.1
DHCPACK of 51.159.53.140 from 51.159.53.1
bound to 51.159.53.140 -- renewal in 2147483648 seconds.
Waiting for DAD... Done
online:
Hello,
did you setup your network interface as follow : auto eno1 iface eno1
inet6 staticaddress IPV6ADDRESS netmask PREFIXLEN
Can I see nano /etc/network/interfaces please I remain at your
disposal if you have any further questions.
I:
of course can https://s2.ax1x.com/2019/11/26/MxU4Nn.png
cold@FR:~$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
allow-hotplug enp1s0
iface enp1s0 inet dhcp
iface enp1s0 inet6 static
address 2001:bc8:2e51:100::1
netmask 56
accept_ra 1
pre-up dhclient -cf /etc/dhcp/dhclient6.conf -pf /run/dhclient6.enp1s0.pid -6 -P enp1s0
pre-down dhclient -x -pf /run/dhclient6.enp1s0.pid
I:
https://s2.ax1x.com/2019/11/26/MxUHjU.png
it is my Network configuration
online:
Hello,
perfect, can I try to replicate the issue from the rescue mode ? I
remain at your disposal if you have any further questions.
I:
Of course, how can I provide a rescue mode? Thank you
online:
Hello,
No need to provide the rescue mode, we can directly reboot to it on
our end!I have thus restarted your server in rescue mode and performed an IPv6
test on it, here is the whole session log:
https://zerobin.net/?a6f957ef1ba3c767#wwqwDBomZixua70KpOvrIAQrWKwNrJb7cfpPF21xQFc=
Here are the contents of my dhclient6.conf file:
https://zerobin.net/?3f7d761d015ac0be#ooyT4GLbNhkFEIWH8ffpz+DfQWYABpan7ekBlzroavw=I have enabled IPv6 SLAAC before doing those tests as it needs to be
enabled for the server to learn its default IPv6 routes before being
able to request a block via DHCPv6.As you can see here, the IPv6 I set (and the one you tried to set on
your end) works correctly after configuration: root@par-dev:~# ping6
2001:bc8:2e51:100::1 PING 2001:bc8:2e51:100::1 (2001:bc8:2e51:100::1):
56 data bytes 64 bytes from 2001:bc8:2e51:100::1: icmp_seq=0 ttl=57
time=4.119 ms 64 bytes from 2001:bc8:2e51:100::1: icmp_seq=1 ttl=57
time=1.851 ms 64 bytes from 2001:bc8:2e51:100::1: icmp_seq=2 ttl=57
time=1.557 msPlease let me know if you have further questions.
I:
Hello there. Starting ipv6 slaac will automatically assign a ipv6
address of / 64, so why do I still need to get ipv6 blocks.
online:
Hello,
This allows you to configure more than one IPv6 on your server should
you need it, and is not necessary if you only need one address as one
will automatically be configured for your with SLAAC. If you have
further questions, please do not hesitate to ask.
I:
I use ipv6 slaac. Is the ipv6 address assigned to me not a / 64
subnet?
online:
Hello,
SLAAC does assign you an IPv6 from a /64 subnet, but this does not
mean that the whole /64 block belongs to you, and you will most likely
not be able to assign other IPs in that same block.
I:
Is it possible that most of the online machines have no slaac option?
When I searched for tutorials, they didn't say to open slaac, so I
didn't expect to open slaac at first.Just now I asked the people who bought the online machine together,
and they said: Except for a few servers with the slaac option, they
have to be configured by themselves. High-end machines do not have
ipv6 slaac option.
online:
Indeed not all of our machine have the SLAAC option.
总结一下:
1.服务器管理界面没有ipv6 slaac,你需要提交工单给客服表面你需要使用ipv6
2.服务器界面有ipv6 slaac选项,你必须启用ipv6 slaac选项才能使用ipv6
I have enabled IPv6 SLAAC before doing those tests as it needs to be enabled for the server to learn its default IPv6 routes before being able to request a block via DHCPv6.
这个是关键.
大概的意思是:
在进行这些测试之前,我已经启用了IPv6 SLAAC,因为需要先启用IPv6 SLAAC,服务器才能学习其默认IPv6路由,然后才能通过DHCPv6请求阻止。
换句话说,就是启用了ipv6 slaac,ipv6的通信才能通过onlie的“防火墙”
上面的内容虽多,但都是下面能成功的关键点:
我们进入服务器的管理界面,在界面的左边,有一列选项,我们点击ipv6进入ipv6的界面:

点击
ORDER A FREE /48 IPV6 BLOCK
来获取免费的ipv6网络段
点击后效果如下所示:

他会给你的账号一个免费的ipv6段,不清楚具体有多少个反正你是不可能用的完的
如果你是多台服务器,就选择
create subnet
就可以新建 ipv6 段了,用新的信息就可以了。
随后使用ssh进入系统,手动获取ipv6地址。
首先安装软件源,编辑
/etc/apt/sources.list
添加以下内容:#DHCP6 Client
deb http://httpredir.debian.org/debian experimental main
然后安装odhcp6c
apt-get update
apt-get install odhcp6c
通过ip addr
查看你的物理网卡的名称,例如enp1s0
通过online网页的服务器控制台得到IPv6地址信息:
(即IPv6 Blocks的那堆东西)
IPv6:2001:bc8:2e51:100::/56
DUID:00:03:00:01:58:f3:27:dc:3d:1d
在/etc/network/interfaces中添加以下内容:
post-up odhcp6c -P 56 -c 00:03:00:01:58:f3:27:dc:3d:1d enp1s0 -d
post-up ip -6 a a 2001:bc8:2e51:100::/56 dev enp1s0
post-up ip -6 r a 2001:bc8:2e51:100::/56 dev enp1s0
重启服务器。
现在ip addr虽然显示了ipv6地址,但还不能使用ipv6
随后ping一下ipv6即可验证是否真的开启了ipv6。
ping6 ipv6.google.com
请注意,linux使用的是ping6,而不是和Windows一样是ping,还有域名别输错了
使用ip addr
可以发现只有一个ipv6地址:
使用api获取你的服务器访问外界使用的ipv6地址,可以和你ip addr得到的ip地址相比较:
curl 'https://api6.ipify.org?format=json'
显示:
{"ip":"2001:bc8:2e51:100::"}
即为你的对外ip.
虽然是被坑了但确实是参考:
单IP服务器利用ProxmoxVE建立IPv4-NAT和IPv6虚拟机
online服务器通过odhcp6配置ipv6
版权属于:寒夜方舟
本文链接:https://www.wnark.com/archives/24.html
本站所有原创文章采用署名-非商业性使用 4.0 国际 (CC BY-NC 4.0)。 您可以自由地转载和修改,但请注明引用文章来源和不可用于商业目的。声明:本博客完全禁止任何商业类网站转载,包括但不限于CSDN,51CTO,百度文库,360DOC,AcFun,哔哩哔哩等网站。