禁用服务商提供的IPV6地址,防止HE检测滥用
nano /etc/network/interfaces
找到 iface eth0 inet dhcp 这一行,在它下方新增以下内容(禁用该网卡的 IPv6)
iface eth0 inet6 manual
pre-up sysctl -w net.ipv6.conf.eth0.disable_ipv6=1
重启测试
systemctl restart networking
编辑网络配置文件(Debian 12 默认用 /etc/network/interfaces)
执行命令打开配置文件:
nano /etc/network/interfaces
将你提供的 HE 隧道配置内容追加到文件末尾(注意核对信息是否与你的隧道一致,尤其是 local 字段):HE IPv6 Tunnel Configuration
auto he-ipv6
iface he-ipv6 inet6 v4tunneladdress 2001:420:c:222::2 # 隧道的客户端IPv6(HE隧道页面的“Client IPv6 Address”) netmask 64 # 子网掩码,HE默认是64 endpoint 66.220.18.42 # HE隧道的服务器IP(“Server IPv4 Address”) local 202.22.122.128 # 你的VPS的公网IPv4(必须和HE隧道绑定的IP一致!) ttl 255 gateway 2001:420:c:222::1 # 隧道的网关IPv6(“Server IPv6 Address”)
编辑完成后,保存退出。
- 启动 IPv6 隧道接口
执行命令启动 he-ipv6 接口:
ifup he-ipv6
如果启动无报错,继续下一步验证;如果报错(如 “local address not available”),需先确认 local 207.2.120.28 是否是你 VPS 的实际公网 IPv4(可通过 curl icanhazip.com 查看 VPS 真实 IPv4,若不一致,需修改配置文件中的 local 字段)。 - 验证 IPv6 是否生效
查看接口状态:确认 he-ipv6 接口已获取 IPv6 地址
ip -6 addr show he-ipv6
测试 IPv6 连通性:ping HE 的网关或公共 IPv6 地址
ping6 -c 4 2001:420:c:222::1 # ping隧道网关
若能收到回复,说明 IPv6 隧道已通。 - 配置 IPv6 DNS(可选,避免无法解析 IPv6 域名)
编辑 /etc/resolv.conf 添加 IPv6 DNS(如谷歌 DNS 或 Cloudflare DNS):
vi /etc/resolv.conf
nameserver 2001:4860:4860::8888 # 谷歌IPv6 DNS
nameserver 2606:4700:4700::1111 # Cloudflare IPv6 DNS
防火墙放行 IPv6:Debian 12 默认用 nftables,需确保允许 IPv6 流量(尤其是 ICMPv6,ping6 依赖它)