Tunnel 套娃套娃再套娃

自从有了最弱主网,就搞了隧道给其他机用,突发奇想可不可以套娃又套娃,说干就干.

我举例一个前缀:2404:f4c0:f4c0::/48 <= 应该没有人照抄吧.

然后设置第一层套娃前缀:2404:f4c0:f4c0:fe00::/56

# 上游
ip tunnel add tun0 mode sit remote 107.175.115.71 local 45.61.184.212 ttl 255
ip link set tun0 up
ip addr add 2404:f4c0:f4c0:ff00::1/64 dev tun0
ip route add 2404:f4c0:f4c0:fe00::/56 dev tun0
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
sysctl -p

# 下游
ip tunnel add tun0 mode sit remote 45.61.184.212 local 107.175.115.71 ttl 255
ip link set tun0 up
ip addr add 2404:f4c0:f4c0:ff00::2/64 dev tun0
ip route add ::/0 dev tun0
ping -c 4 2001:4860:​4860::8888

现在一级,很正常的操作,开始二级套娃,显得我IP很多.

# 上游
ip tunnel add tun1 mode sit remote 172.245.168.204 local 107.175.115.71 ttl 255
ip link set tun1 up
ip addr add 2404:f4c0:f4c0:fe00:fe00::1/72 dev tun1
ip route add 2404:f4c0:f4c0:fefe::/64 dev tun1
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
sysctl -p

# 下游
ip tunnel add tun1 mode sit remote 107.175.115.71 local 172.245.168.204 ttl 255
ip link set tun1 up
ip addr add 2404:f4c0:f4c0:fe00:fe00::2/72 dev tun1
ip route add ::/0 dev tun1
ping -c 4 2001:4860:​4860::8888

接下来三级四级套原理也是一样,我这里每次套丢8个位.

# 上游
ip tunnel add tun2 mode sit remote 107.172.198.161 local 172.245.168.204 ttl 255
ip link set tun2 up
ip addr add 2404:f4c0:f4c0:fefe:fe00::/80 dev tun2
ip route add 2404:f4c0:f4c0:fefe:fefe::/72 dev tun2
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
sysctl -p

# 下游
ip tunnel add tun2 mode sit remote 172.245.168.204 local 107.172.198.161 ttl 255
ip link set tun2 up
ip addr add 2404:f4c0:f4c0:fefe:fe00::2/80 dev tun2
ip route add ::/0 dev tun2
ping -c 4 2001:4860:​4860::8888

思考,能不能每次只让一个位,这样会链更长的链条,用途?我不关系,比如拆成两段.

  • 2404:f4c0:f4c0:0000::/49
  • 2404:f4c0:f4c0:8000::/49

感觉疯狂吧,看下面这个变态的设置.

/127是最小分配前缀(RFC6164),总共有2个可用地址,就是给机器抠门的分一个地址,又大方地分一个前缀,估计没人这么干吧.

# 上游
ip tunnel add tun0 mode sit remote 107.175.115.71 local 45.61.184.212 ttl 255
ip link set tun0 up
ip addr add 2404:f4c0:f4c0:0001:cc9b:4a3b:a3d0:11ec/127 dev tun0
# ip route add 2404:f4c0:f4cf::/49 dev tun0 <= 如果你本机有占/48就不能分/48
ip route add 2404:f4c0:f4cf::/48 dev tun0
echo "net.ipv6.conf.all.forwarding = 1" >> /etc/sysctl.conf
sysctl -p


# 下游
ip tunnel add tun0 mode sit remote 45.61.184.212 local 107.175.115.71 ttl 255
ip link set tun0 up
ip addr add 2404:f4c0:f4c0:0001:cc9b:4a3b:a3d0:11ed/127 dev tun0
ip route add ::/0 dev tun0
ping -c 4 2001:4860:​4860::8888

然后继续我的细分/49大业,按照1bit串一次,大概…可以串上多少呢?可以路由全球飞.

那么套娃的意义是?分级管理?增加延迟?

发表评论

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