蘋果上架要求:要求支持IPV6only(因?yàn)榘⒗镌浦鳈C(jī)沒有IPV6only)
確認(rèn)IPV6是否開啟:
方式1:使用ifconfig查看自己的IP地址是否含有IPv6地址。
方式2.查看服務(wù)監(jiān)聽的IP中是否有IPv6格式的地址。(netstat -tuln)
開啟IPV6:
vim?/etc/sysctl.conf
vim /etc/modprobe.d/disable_ipv6.conf
vim /etc/sysconfig/network
至此ipv6的服務(wù)器端支持已經(jīng)完成,重啟服務(wù)器測(cè)試是否支持ipv6,重啟后,?ifconfig查看ipv6的信息,有看到有關(guān)IPV6的輸出就可以
添加ipv6隧道:
1. 注冊(cè)Tunnel broker
https://www.tunnelbroker.net/
注冊(cè)很容易,就不講了,注冊(cè)需要郵箱驗(yàn)證,,gmail、163能收得到認(rèn)證郵件,qq還是一樣收不到
?2.創(chuàng)建通道“Create Regular Tunnel”
填寫云服務(wù)器ip以及選擇默認(rèn)的隧道節(jié)點(diǎn),點(diǎn)擊Create Tunnel創(chuàng)建。填寫ip都,如果出現(xiàn)“IP is a potential tunnel endpoint.”則證明可以添加ipv6隧道,一般隧道節(jié)點(diǎn)系統(tǒng)已經(jīng)默認(rèn)分配,可以手動(dòng)選擇,大家可以在自己的云服務(wù)器上分別ping一下這些ip,選時(shí)延低的。
3.創(chuàng)建ipv6隧道及路由
到下一頁面切換到Example configurations選項(xiàng)卡,如果你的VPS是centOS/Debian這些常見Linux的話,下拉菜單選擇Linux-route2,出現(xiàn)了設(shè)置的命令,復(fù)制到自己的云服務(wù)器上運(yùn)行。如果是“專有網(wǎng)絡(luò)”,需要將HE配置隧道地址命令中的IPv4地址修改為ECS實(shí)例的內(nèi)網(wǎng)地址。
如
modprobe ipv6
ip tunnel add he-ipv6 mode sit remote 【Tunnel 的 Server IPv4 Address】 local 【阿里云的內(nèi)網(wǎng) IPv4 地址】 ttl 255
ip link set he-ipv6 up
ip addr add 【IPv6】/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr
4.測(cè)試ipv6
添加ipv6的dns服務(wù)器,在最后添加nameserver 2001:4860:4860::8888,nameserver 2001:4860:4860::8844谷歌的ipv6 dns服務(wù)器
# vim /etc/resolv.conf
options timeout:1attempts:1 rotate
nameserver x.x.x.x
nameserver x.x.x.x
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
# ping6 -c 5 ipv6.google.com
PING ipv6.google.com(tsa03s01-in-x0e.1e100.net) 56 data bytes
bytes from tsa03s01-in-x0e.1e100.net: icmp_seq=1 ttl=55 time=25.5 ms
bytes from tsa03s01-in-x0e.1e100.net: icmp_seq=2 ttl=55 time=25.5 ms
bytes from tsa03s01-in-x0e.1e100.net: icmp_seq=3 ttl=55 time=33.1 ms
bytes from tsa03s01-in-x0e.1e100.net: icmp_seq=4 ttl=55 time=25.5 ms
bytes from tsa03s01-in-x0e.1e100.net: icmp_seq=5 ttl=55 time=25.4 ms
--- ipv6.google.com ping statistics ---
packets transmitted, 5 received, 0% packet loss, time 4031ms
rtt min/avg/max/mdev = 25.473/27.040/33.180/3.073 ms
NGINX 配置
1、nginx開啟IPV6支持配置
到nginx的sbin目錄,cd /usr/local/nginx/sbin,執(zhí)行命令./nginx -V
若沒有出現(xiàn)--with-ipv6,說明當(dāng)前的nginx不支持ipv6,我們需要重新編譯Nginx,配置里面增加--with-ipv6
2、nginx配置ipv6監(jiān)聽
listen 80;
listen [ ipv6 ]:80;
listen 443 ssl http2;
listen [ipv6]:443 ssl http2;
域名解析
為網(wǎng)站域名添加AAAA解析,值填 HE 里的Client IPv6 Address,去掉最后的/64 即可。如2001:470:1f18:583::2。
測(cè)試
http://ipv6-test.com/validate.php在這個(gè)網(wǎng)址中輸入你的域名就可以了,只要下面兩項(xiàng)可以過就可以提交app審核了:
AAAA DNS record
IPv6 web server
如下圖所示即表示站點(diǎn)已支持IPv6訪問。
如果IPv6 web server出現(xiàn)web server is unreachable : Connection timed out,自己寫一個(gè)定時(shí)腳本ping指定網(wǎng)址,如ping6 ipv6.baidu.com