相信上架App Store的基本都會遇到這樣的問題,着實讓人很頭大的。出現這樣的緣由是,因爲國內大部分IP目前都是使用IPv4,App Store審覈時會先訪問DNS服務器,得到iOS應用服務器的IPv6地址,再進行訪問,若是DNS服務網沒法成功解析到IPv6地址,出如今提交App Store審覈時被拒的狀況。php
須要說明的是,這不是客戶端的問題,也不是後端程序的事,而是服務器運維方面的工做。現整理以下:linux
一、修改 /etc/modprobe.d/disable_ipv6.confnginx
## 修改 options ipv6 disable 爲 0 cp /etc/modprobe.d/disable_ipv6.conf /etc/modprobe.d/disable_ipv6.conf_backup ##先備份原始配置 vi /etc/modprobe.d/disable_ipv6.conf #修改前 alias net-pf-10 off options ipv6 disable=1 #修改後 alias net-pf-10 off options ipv6 disable=0
二、修改/etc/sysconfig/networkweb
##修改 NETWORKING_IPV6 爲 yes cp /etc/sysconfig/network /etc/sysconfig/network_backup vi /etc/sysconfig/network 修改前 PEERNTP=no NETWORKING_IPV6=no GATEWAY=139.255.255.0 修改後 PEERNTP=no NETWORKING_IPV6=yes GATEWAY=139.255.255.0
三、修改 /etc/sysconfig/network-scripts/ifcfg-eth0後端
## 添加 IPV6INIT 爲 yes 和 IPV6_AUTOCONF 爲 yes cp /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth0_backup vi /etc/sysconfig/network-scripts/ifcfg-eth0 修改前 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=10.10.10.1 NETMASK=255.255.254.0 修改後 DEVICE=eth0 ONBOOT=yes BOOTPROTO=static IPADDR=10.10.10.1 NETMASK=255.255.254.0 IPV6INIT=yes IPV6_AUTOCONF=yes
四、 修改 /etc/sysctl.confcentos
## 修改 net.ipv6.conf.all.disable_ipv6 爲 0, net.ipv6.conf.default.disable_ipv6 爲 0 和 net.ipv6.conf.lo.disable_ipv6 爲 0 cp /etc/sysctl.conf /etc/sysctl.conf_backup vi /etc/sysctl.conf 修改前 vm.swappiness = 0 net.ipv4.neigh.default.gc_stale_time=120 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.all.arp_announce=2 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 1024 net.ipv4.tcp_synack_retries = 2 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 net.ipv6.conf.lo.disable_ipv6 = 1 net.ipv4.conf.lo.arp_announce=2 修改後 vm.swappiness = 0 net.ipv4.neigh.default.gc_stale_time=120 net.ipv4.conf.all.rp_filter=0 net.ipv4.conf.default.rp_filter=0 net.ipv4.conf.default.arp_announce = 2 net.ipv4.conf.all.arp_announce=2 net.ipv4.tcp_max_tw_buckets = 5000 net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_max_syn_backlog = 1024 net.ipv4.tcp_synack_retries = 2 net.ipv6.conf.all.disable_ipv6 = 0 net.ipv6.conf.default.disable_ipv6 = 0 net.ipv6.conf.lo.disable_ipv6 = 0 net.ipv4.conf.lo.arp_announce=2
五、建立系統在啓動時自動加載 IPv6 模塊的腳本服務器
建立腳本文件 ipv6.modules vi /etc/sysconfig/modules/ipv6.modules 腳本內容 !/bin/sh if [ ! -c /proc/net/if_inet6 ] ; then exec /sbin/insmod /lib/modules/uname -r/kernel/net/ipv6/ipv6.ko fi
六、重啓系統,加載 IPv6 模塊
查看 IPv6 模塊cookie
ifconfig | grep -i inet6 #### 查看ipv6的信息,有看到輸出就能夠 inet6 addr: fe80::x:x:x:x/64 Scope:Link inet6 addr: fe80::x:x:x:x/64 Scope:Link inet6 addr: x:x:x:x::2/64 Scope:Global inet6 addr: fe80::x:x/128 Scope:Link inet6 addr: ::1/128 Scope:Host
一、在 tunnelbroker.net 上申請一個免費的 IPv6 地址,現註冊個帳號。
二、選擇 Create Regular Tunnel 建立一個到本身公網 IP 的通道。
三、選擇HK,不過有時候也滿了,選擇Freemont,CA,US 也能夠。
四、找到 Example Configurations,centos7.x 選擇 linux-net-tools,複製命令,去服務器上執行。app
ifconfig sit0 up ifconfig sit0 inet6 tunnel ::64.62.134.130 ifconfig sit1 up ifconfig sit1 inet6 add 2001:470:66:dab::2/64 route -A inet6 add ::/0 dev sit1
ping 一下服務器的 IPv6 地址,看看是否工做正常(CentOS 上 IPv6 版的 ping 名爲 ping6)運維
PING 2001:470:66:dab::2(2001:470:66:dab::2) 56 data bytes 64 bytes from 2001:470:66:dab::2: icmp_seq=1 ttl=64 time=0.030 ms 64 bytes from 2001:470:66:dab::2: icmp_seq=2 ttl=64 time=0.042 ms 64 bytes from 2001:470:66:dab::2: icmp_seq=3 ttl=64 time=0.042 ms 64 bytes from 2001:470:66:dab::2: icmp_seq=4 ttl=64 time=0.042 ms 64 bytes from 2001:470:66:dab::2: icmp_seq=5 ttl=64 time=0.043 ms 64 bytes from 2001:470:66:dab::2: icmp_seq=6 ttl=64 time=0.041 ms
注意
使用ifconfig查看下,是不是如下返回
[root@izbp1f9dlc41312rkw2q66z ~]# ifconfig eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 172.xx.xx.xx netmask 255.255.240.0 broadcast 172.xx.xx.xx inet6 fe80::216:3eff:fe0e:16b8 prefixlen 64 scopeid 0x20<link> ether 00:16:3e:0e:16:b8 txqueuelen 1000 (Ethernet) RX packets 916751 bytes 496948639 (473.9 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 573020 bytes 246191113 (234.7 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (Local Loopback) RX packets 50551 bytes 3304726 (3.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 50551 bytes 3304726 (3.1 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 sit0: flags=193<UP,RUNNING,NOARP> mtu 1480 inet6 ::127.0.0.1 prefixlen 96 scopeid 0x90<compat,host> inet6 ::172.xx.xx.xx prefixlen 96 scopeid 0x80<compat,global> sit txqueuelen 1 (IPv6-in-IPv4) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 sit1: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1480 inet6 2001:470:66:dab::2 prefixlen 64 scopeid 0x0<global> inet6 fe80::ac10:8b24 prefixlen 64 scopeid 0x20<link> sit txqueuelen 1 (IPv6-in-IPv4) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
必須這樣的才能夠,不然在檢測 ipv6 webserver 的時候 返回error
server { listen 80; // 監聽 IPv4 的 80 端口, HTTP 協議 listen [::]:80; // 監聽 IPv6 的 80 端口, HTTP 協議 server_name example.com; …… } server { listen 443; // 監聽 IPv4 的 443 端口, HTTPS 協議 listen [::]:443; // 監聽 IPv6 的 443 端口, HTTPS 協議 …… }