最近抢到了online 3o独服,目前网上大部分获取Ipv6的方法都是向客服提交tk,并进行一堆的设置。

这样麻烦一点倒也没事,更无语的是一堆人乱写,瞎拷贝,坑了我几个晚上。

目前有两种方法,一种是使用ipv6 slaac,还有一种是使用赠送的IPv6 Blocks。

这个教程IPv6 Blocks仅供debian使用,centos无法使用这个教程配置IPv6 Blocks/scode]

使用ipv6 slaac

[scode type="red"]如果你使用独服开小鸡,请不要用ipv6 slaac,具体原因在下面的ipv6 blocks有详细的介绍


使用方法非常简单:
进入服务器界面,查看在服务器界面下方有这个东西:
ipv6-4.png
如果有,那么恭喜你可以用ipv6 slaac启用Ipv6了,如果没有,请看使用ipv6 blocks教程

点击ACTIVATE IPV6 SLAAC
就会显示一个ipv6地址:
ipv6-5.png
这个地址即为系统自动给你分配的地址。

关于ipv6 slaac,这里贴一下archwiki的内容:

无状态地址自动配置 (SLAAC)
在网络准备好的情况下,获取IPv6地址最简单的方法是通过“无状态地址自动配置”(SLAAC)。地址会自动由路由器给出的前缀推算出,不需要其他配置,也不需要DHCP客户端。

这个ipv6地址即为你机器的ipv6地址,无论你机器是centos还是debian甚至esxi,都是用的这个地址,并且无需你手动配置。

部分系统没有直接自动给你配置好ipv6地址,需要你打开ipv6 slaac后重装/重启系统,就有ipv6地址了

使用IPv6 Blocks

这个耗费了我n多天,无数精力,网上没有一篇文章提到使用ipv6 blocks要打开ipv6 slaac,最后我通过提交工单和自己的测试解决了所有人都觉得“理所当然”的问题。

在这里我要先感谢:
轻风伴梦提供他的online独服供我进行测试,节省了我等待服务器重装的时间
handsome售后群里的各位小伙伴们:提普NMD-WSM,......
hostloc里的水贴
Online - Ian | Online - Vincent | Online - Chloé | Online - Jaroslaw 这四位客服接力解决我的问题。

我和online客服的对话记录

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

[email protected]:/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 static

address 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

[email protected]:~$ 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: [email protected]:~# 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 ms

Please 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.

总结一下:

online并不是所有的机器在管理界面都有ipv6 slaac选项,也不是只有“低端的机器才有ipv6 slaac”,但是如果你需要使用ipv6 blocks
1.服务器管理界面没有ipv6 slaac,你需要提交工单给客服表面你需要使用ipv6
2.服务器界面有ipv6 slaac选项,你必须启用ipv6 slaac选项才能使用ipv6

虽然ipv6 slaac从/64子网分配给了你ipv6,但是并不意味着整个/64子网都属于你,很有可能你无法从这个子网中再次获取ipv6地址,如果你是用独服开小鸡,这对你非常重要,一定不要使用ipv6 slaac,请使用ipv6 blocks提供的ipv6

上面的内容虽多,但都是下面能成功的关键点:

该方法仅在debian9下面测试通过,可能在其他系统下不能正确获取ipv6

现在先关闭ipv6 slaac选项,避免自动分配的ipv6对我们造成影响

我们进入服务器的管理界面,在界面的左边,有一列选项,我们点击ipv6进入ipv6的界面:
ipv6-1.png
点击ORDER A FREE /48 IPV6 BLOCK来获取免费的ipv6网络段
ipv6-2.png
点击后效果如下所示:
ipv6-3.png
他会给你的账号一个免费的ipv6段,不清楚具体有多少个反正你是不可能用的完的
如果你是多台服务器,就选择create subnet就可以新建 ipv6 段了,用新的信息就可以了。
online目前限制了/56子网的获取量,目前是一台机器只能免费获取一个子网

p345-1.png
随后使用ssh进入系统,手动获取ipv6地址。
online.net提供IPv6地址是需要通过DHCP客户端获得,且官方给的教程安装,不适用于最新的ProxmoxVE环境,即使按照教程修改配置好,又会出现一个小时左右就断开连接的问题,所以我们另外使用odhcp6c来获得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

online现在新增多少个子网就要购买多少个ipv4,所以子网的数量是有限的

重启服务器。
现在ip addr虽然显示了ipv6地址,但还不能使用ipv6
现在打开ipv6 slaac,等待ipv6 slaac正式启动完成后,再次重启

随后ping一下ipv6即可验证是否真的开启了ipv6。

ping6 ipv6.google.com

请注意,linux使用的是ping6,而不是和Windows一样是ping,还有域名别输错了
ipv6-6.png
使用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

最后修改:2020 年 03 月 24 日 11 : 42 PM