1.去tunnelbroker上申请账号
在https://tunnelbroker.net/register.php 注册就行,注意地址里不要有奇奇怪怪的符号,一个ip在一段时间内只能注册一个,选择的国家即为你想要落地的国家。
2.选择入站地点+分配v6
在左侧 Create Regular Tunnel https://tunnelbroker.net/new_tunnel.php
地点其实无所谓,选择离小鸡近的就行
选好之后保存,在 Tunnel Details 页面可以看到创建的 IPv6 隧道的详细信息,其中 Client IPv6 Address 是分配给你的公网 IPv6 地址。
在 Tunnel Details 页面有个 Example Configuration 选项卡,在这里你可以选择合适的配置示例。就比如这里有 Debian 的 interfaces 配置文件示例:
3.vps端配置
- Debian/Ubuntu系统
在 /etc/network/interfaces.d/ 目录下创建名为 he-ipv6 的文件
touch /etc/network/interfaces.d/he-ipv6
复制以下内容
auto he-ipv6
iface he-ipv6 inet6 v4tunnel
address
netmask
endpoint
local
ttl
gateway
打开/etc/network/interfaces文件,看看有没有这句话
source /etc/network/interfaces.d/*
如果没有,添加上并保存
安装网络工具包
sudo apt update
sudo apt install net-tools iproute2 -y
启动 he-ipv6 网络接口
sudo ifup he-ipv6
重启网络
systemctl restart networking
- Alpine系统
ip tunnel add he-ipv6 mode sit remote <endpoint> local <local> ttl <ttl> #创建隧道
ip link set he-ipv6 up #启动隧道接口
ip addr add <address/netmask> dev he-ipv6 #添加正确的IPv6地址
ip -6 route add default via <gateway> dev he-ipv6 #添加默认路由
测试IPv6连接:
ping6 ipv6.google.com
检查路由表:
ip -6 route show
如果一切正常,将这些配置添加到启动脚本中:
创建/etc/local.d/he-ipv6.start:
touch /etc/local.d/he-ipv6.start
输入以下内容
#!/bin/sh
ip tunnel add he-ipv6 mode sit remote <endpoint> local <local> ttl <ttl>
ip link set he-ipv6 up
ip addr add <address/netmask> dev he-ipv6
ip -6 route add default via <gateway> dev he-ipv6
设置可执行权限:
chmod +x /etc/local.d/he-ipv6.start
启用本地服务:
rc-update add local default
rc-service local restart