我有大约40亿IPV6 ips,我想将一些分配到我的外部VPS中,而不是在同一个D.C中,ipv6 ips也在运行ubuntu10.04的VPS上。
我该怎么做?例如,将我的VPS上的10个ipv6 ips分配给另一个外部VPS,以便外部VPS可以使用它们??
发布于 2010-07-23 10:31:46
除非您对地址空间的路由有一定的控制,否则所有IPv6通信将不得不通过您的Ubuntu机器进行传输。
一个简单的方法是GRE隧道(如果您的所有客户端都有可公开的可实现地址)或openvpn。由于您的机器不在同一数据中心,因此openvpn最好在tun模式下使用。
首先,您需要为每个站点选择一个IPv6子网和前缀。你说你有大约40亿个地址,这将是一个/96前缀。假设您的网关服务器有地址2001:xx..xx::1/96。决定要分配给其他服务器的前缀。例如,使用/112将使您拥有65k vpse,每个vpse都有65k地址。假设您的第一个客户端将拥有2001:xx..xx:1::/112。在这个块中,网关将使用2001:xx..xx:1::1/112,其余的将用于客户端。(从技术上讲,这是可以避免的,但这是通常的做法)
以下是Ubuntu的两个教程,分别用于6至4和格瑞隧道。你想要的是介于两者之间的东西。
在客户身上,使用类似的方法
auto tun0
iface tun0 inet6 static
address 2001:xx..xx:1::2
netmask 112
pre-up iptunnel add tun0 mode gre local <client IPv4> remote <gateway IPv4>
pointopoint 2001:xx..xx:1::1
post-down iptunnel del tun1
up ip route add 2000::/3 dev tun1在网关上,每个客户端:
auto tun-server1
iface tun-server1 inet6 static
address 2001:xx..xx:1::1
netmask 112
pre-up iptunnel add tun-server1 mode gre local <gateway IPv4> remote <client IPv4>
pointopoint 2001:xx..xx:1::2
post-down iptunnel del tun1或者,您也可以在tun6模式下使用openvpn。每个隧道都需要一个单独的openvpn实例。在网关上和每个客户端(带有静态密钥)上,配置都是最小的:
secret "/etc/openvpn/server1.key"
dev-type tun
tun-ipv6
dev tun-server1
local <Gateway IPv4>
proto tcp-server在客户端上,只有一个实例:
secret "/etc/openvpn/server1.key"
dev-type tun
tun-ipv6
dev tun0
remote <Gateway IPv4>
proto tcp-client如果客户端具有公共的可重缓存地址,则可以删除proto指令以使用UDP (更有效),只要在两边添加丢失的remote和local指令即可。
文件server1.key必须包含共享密钥,这对于每个客户端来说都是不同的。您可以使用openvpn --genkey --secret server1.key生成它们
在那之后,你需要像以前一样建立适当的路线。这里有关于使用证书设置openvpn的文档(第一部分是关于使用证书设置openvpn;您可以首先使用静态键,因为安装速度更快):
https://serverfault.com/questions/163339
复制相似问题