前陣子黑五買了VirMach超殺搶購的VPS 🐱🏍 但是都沒有IPv6,所以我把目光轉向Hurricane Electric提供的IPv6 Tunnel服務,HE.net在美國算是非常大的資料中心服務商了,穩定度還是可以相信滴,這邊留個筆記~🤖🤓🤖
申請方式
STEP1. 先到HE.net的IPv6 Tunnel服務申請一個帳號,然後進入左手邊的Create Regular Tunnel開始申請
STEP2. 在Create New Tunnel的頁面,IPv4 Endpoint (Your side):這個框框要輸入實際可連網的IP,Available Tunnel Servers就選擇地理位置靠近的地方,大致上就是選以下幾個地方吧。
- Los Angeles, CA, US 66.220.18.42
- Fremont, CA, US 72.52.104.74
- Fremont, CA, US 64.62.134.130
- Hong Kong, HK 216.218.221.6
- Singapore, SG 216.218.221.42
- Tokyo, JP 74.82.46.6
STEP3. 申請成功後,把Tunnel Details頁面列印出來或是轉存成pdf,然後記住此四項紀錄
- Server IPv4 Address: 72.52.104.74
- Client IPv4 Address: 107.172.xxx.xxx
- Client IPv6 Address: 2001:470:xxx:xxx::xxx/64
- Server IPv6 Address: 2001:470:1f04:1b7::1
SSH操作紀錄
### 啟用IPv6功能
1 2 3 4 5 6 |
echo 'net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0' >> /etc/sysctl.conf cat /etc/sysctl.conf | grep ipv6 sudo sysctl --system sudo sysctl -p |
### 啟用IPv6網路支援
1 2 3 4 5 |
modprobe ipv6 sed -i '/IPV6_AUTOCONF/d' /etc/sysconfig/network sed -i '/NETWORKING_IPV6/d' /etc/sysconfig/network echo 'NETWORKING_IPV6=yes' >> /etc/sysconfig/network cat /etc/sysconfig/network | grep IPV6 |
### 設定IPv6通道的網路介面
IPV6TUNNELIPV4=【Server IPv4 Address】
IPV6TUNNELIPV4LOCAL=【Client IPv4 Address】
IPV6ADDR=”【Client IPv6 Address,加上/64】”
IPV6_DEFAULTGW=”【Server IPv6 Address,不要加上/64】”
cat <<"EOF" > /etc/sysconfig/network-scripts/ifcfg-heipv6
NAME="heipv6"
DEVICE=heipv6
ONBOOT=yes
USERCTL=yes
BOOTPROTO=none
PEERDNS=no
IPV6TUNNELIPV4=【Server IPv4 Address】
IPV6TUNNELIPV4LOCAL=【Client IPv4 Address】
IPV6ADDR="【Client IPv6 Address,加上/64】"
IPV6_DEFAULTGW="【Server IPv6 Address,不要加上/64】"
IPV6INIT=yes
IPV6_AUTOTUNNEL=yes
IPV6_ROUTER=yes
IPV6_AUTOCONF=no
IPV6_CONTROL_RADVD=yes
PHYSDEV=eth0
TYPE=sit
DEVICETYPE=sit
NM_CONTROLLED=no
IPV6_DEFAULTDEV=heipv6
EOF
clear
cat /etc/sysconfig/network-scripts/ifcfg-heipv6
### 重啟網路
systemctl restart network
### 驗證IPv6網路狀況,有防火牆的可以暫停下來或是重開機試試看
# 透過內建的IP程式連線驗證gateway
/sbin/ip -6 route | grep -v ^unreachable | grep -v ^fe80
# 透過內建的IP程式連線驗證本機IP
/sbin/ip r get to 2001:4860:4860::8888 | perl -ne '/src ([\w:]+)/ && print "$1\n"'
# 連線到icanhazip.com驗證本機IP
curl -6 icanhazip.com
# 基本ping6、traceroute6測試
ping6 -c 1 ordns.he.net
traceroute6 ordns.he.net
ping6 -c 1 ipv6.google.com
traceroute6 ipv6.google.com
### 有時候會莫名其妙碰到下載IPV6很慢的狀況,此時可以使用此指令改用IPv4優先來解決
1 2 3 4 5 6 7 8 9 |
sed -i '/precedence/d' /etc/gai.conf sudo echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf cat /etc/gai.conf sed -i '/prefer-family/d' /etc/wgetrc sudo echo 'prefer-family = IPv4' >> /etc/wgetrc cat /etc/wgetrc | grep prefer-family sed -i '/ipv4/d' ~/.curlrc sudo echo 'ipv4' >> ~/.curlrc cat ~/.curlrc |
ref.