配置阿里雲ECS支持IPv6,解決蘋果app審覈失敗問題

前幾天iOS的App提交給蘋果審覈沒經過,給出的緣由是:該應用在 IPv6 的環境下沒法使用。
檢查發現:阿里雲優化過的系統沒有啓用IPv6協議,須要配置啓用一下,
可是隻單獨啓用IPv6也是沒法直接提供訪問的,可使用 Hurricane Electric提供的IPv6 Tunnel Broker 來讓 ECS 支持 IPv6 。 php

1.檢查確認阿里雲ECS服務器狀態

1.1.檢查確認服務器狀態

如下命令返回值爲0表示IPv6啓用,1表示禁用,html

cat /proc/sys/net/ipv6/conf/all/disable_ipv6
cat /proc/sys/net/ipv6/conf/default/disable_ipv6

文件不存在表示被禁用了linux

1.2.查看IP進一步確認

ifconfig 
ip address list

只有IPv4的IP地址,能夠確認IPv6功能並無啓用nginx

1.3.配置服務器啓用IPv6功能

# 修改網絡配置信息web

vim /etc/sysconfig/network
-------------------------
# made for IPv6
NETWORKING_IPV6=yes
-------------------------

# 增長dns解析地址vim

vim /etc/resolv.conf
-------------------------
......
# IPv6 DNS by google
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844
-------------------------

# 修改內核參數,啓用IPv6配置服務器

vim /etc/sysctl.conf
-------------------------
# for enable ipv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
-------------------------
sysctl -p

發現報錯了:錯誤以下:網絡

error: "net.ipv6.conf.all.disable_ipv6" is an unknown key
error: "net.ipv6.conf.default.disable_ipv6" is an unknown key
error: "net.ipv6.conf.lo.disable_ipv6" is an unknown key

報錯緣由:IPv6模塊沒有啓用app

使用如下命令查看IPv6模塊的啓用狀態curl

lsmod | grep ipv6
-----------------------
[root@zstest ~]# lsmod | grep ipv6   
ipv6                  336944  2 ib_ipoib,ib_addr
-----------------------

相似上面的返回信息,ipv6有用到但不是咱們須要的,執行如下命令手動調用IPv6模塊

modprobe ipv6
----------------------
[root@zstest ~]# modprobe ipv6
FATAL: Module off not found.
----------------------

依然報錯:緣由是IPv6模塊的配置文件爲禁用狀態,須要編輯下
找到該文件,修改成以下內容

vim /etc/modprobe.d/disable_ipv6.conf 
----------------------
#alias net-pf-10 off
#alias ipv6 off
options ipv6 disable=0
----------------------

再次執行modprobe ipv6,無返回執行成功
再次執行lsmod | grep ipv6

[root@zstest ~]# lsmod | grep ipv6
ipv6                  335781  8 

再次執行如下命令,能夠正常運行,若是不成功能夠重啓系統

sysctl -p

執行如下命令,能夠看到IPv6地址已經存才

ifconfig 
ip address list
-------------------------
[root@zstest ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:16:3E:06:E2:CA  
          inet addr:10.10.1.151  Bcast:10.10.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe06:e2ca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3727 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3228 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:424568 (414.6 KiB)  TX bytes:1681556 (1.6 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:934 errors:0 dropped:0 overruns:0 frame:0
          TX packets:934 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:66414 (64.8 KiB)  TX bytes:66414 (64.8 KiB)

[root@zstest ~]# ip address list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:06:e2:ca brd ff:ff:ff:ff:ff:ff
    inet 10.10.1.151/24 brd 10.10.1.255 scope global eth0
    inet6 fe80::216:3eff:fe06:e2ca/64 scope link 
       valid_lft forever preferred_lft forever
------------------------

至此阿里雲服務器的IPv6功能啓用完成,接下來須要配置IPv6的隧道提供對外的IPv6訪問

2.建立IPv6隧道

2.1.首先在官方網站註冊一個帳戶:

https://www.tunnelbroker.net/

2.2.配置IPv6隧道

登錄帳號後,建立隧道Create Regular Tunnel

  

在接下來的頁面須要選擇如下兩個選項
IPv4 Endpoint (Your side)--->填ECS的公網 IP 地址,
Available Tunnel Servers--->選擇隧道服務器位置,通常來講 亞洲的HK離大陸近延遲低,
選擇完畢「Create Tunnel」建立隧道

 

2.3.查看隧道信息

單擊左上角「Main Page」打開首頁,找到剛建立的隧道

單擊進入,查看詳情

補充填入描述信息---> Description:

跟着是一些隧道的IP地址信息,須要記錄下來

2.4.生成建立隧道網卡的命令

在隧道詳情頁,單擊「Example Configurations」標籤,選擇對應的系統類型

個人系統是64位的CentOS-6.9,能夠選擇兩種模式進行配置

(1)模式1:linux-net-tools模式

在阿里雲服務器上執行生成的命令:

# linux-net-tools模式
-----------------------
ifconfig sit0 up
ifconfig sit0 inet6 tunnel ::66.220.18.42
ifconfig sit1 up
ifconfig sit1 inet6 add 2001:470:c:6c3::2/64
route -A inet6 add ::/0 dev sit1
-----------------------

查看ip信息,發現多了兩個網卡sit0和sit1

ifconfig 
ip address list
-----------------------
[root@zstest ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:16:3E:06:E2:CA  
          inet addr:10.10.1.151  Bcast:10.10.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe06:e2ca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:14663 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11931 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1464275 (1.3 MiB)  TX bytes:9011308 (8.5 MiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6176 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6176 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:397496 (388.1 KiB)  TX bytes:397496 (388.1 KiB)

sit0      Link encap:IPv6-in-IPv4  
          inet6 addr: ::127.0.0.1/96 Scope:Unknown
          inet6 addr: ::10.10.1.151/96 Scope:Compat          # 這個是阿里雲服務器內網的IP
          UP RUNNING NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

sit1      Link encap:IPv6-in-IPv4  
          inet6 addr: 2001:470:c:6c3::2/64 Scope:Global
          inet6 addr: fe80::a0a:197/64 Scope:Link
          UP POINTOPOINT RUNNING NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

[root@zstest ~]# ip address list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:06:e2:ca brd ff:ff:ff:ff:ff:ff
    inet 10.10.1.151/24 brd 10.10.1.255 scope global eth0
    inet6 fe80::216:3eff:fe06:e2ca/64 scope link 
       valid_lft forever preferred_lft forever
3: sit0: <NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
    inet6 ::10.10.1.151/96 scope global 
       valid_lft forever preferred_lft forever
    inet6 ::127.0.0.1/96 scope host 
       valid_lft forever preferred_lft forever
7: sit1: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN 
    link/sit 0.0.0.0 peer 66.220.18.42
    inet6 2001:470:c:6c3::2/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::a0a:197/64 scope link 
       valid_lft forever preferred_lft forever
-------------------------

使用如下命令能夠查看IPv6的路由信息

route -A inet6
-------------------------
[root@zstest ~]# route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
*/96                                        *                                       U     256    0        0 sit0    
2001:470:c:6c3::/64                         *                                       U     256    0        0 sit1    
fe80::/64                                   *                                       U     256    0        0 eth0    
fe80::/64                                   *                                       U     256    0        0 sit1    
*/0                                         *                                       U     1      0        0 sit1    
localhost/128                               *                                       U     0      0        1 lo      
::10.10.1.151/128                           *                                       U     0      0        1 lo      
localhost/128                               *                                       U     0      0        1 lo      
ipv6.zuiyoujie.com/128                      *                                       U     0      0        1 lo      
fe80::a0a:197/128                           *                                       U     0      0        1 lo      
fe80::216:3eff:fe06:e2ca/128                *                                       U     0      0        1 lo      
ff00::/8                                    *                                       U     256    0        0 eth0    
ff00::/8                                    *                                       U     256    0        0 sit1    
-------------------------

接下來使用ping6命令測試隧道的聯通性

[root@zstest ~]# ping6 ipv6.google.com
PING ipv6.google.com(hkg12s02-in-x0e.1e100.net) 56 data bytes
64 bytes from hkg12s02-in-x0e.1e100.net: icmp_seq=3 ttl=56 time=326 ms
64 bytes from hkg12s02-in-x0e.1e100.net: icmp_seq=4 ttl=56 time=326 ms
64 bytes from hkg12s02-in-x0e.1e100.net: icmp_seq=5 ttl=56 time=330 ms
64 bytes from hkg12s02-in-x0e.1e100.net: icmp_seq=6 ttl=56 time=326 ms
^C
--- ipv6.google.com ping statistics ---
6 packets transmitted, 4 received, 33% packet loss, time 5974ms
rtt min/avg/max/mdev = 326.864/327.732/330.198/1.480 ms

經過tcpdump抓包以下:

[root@zstest ~]# tcpdump -nn  -i sit1
tcpdump: WARNING: sit1: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on sit1, link-type RAW (Raw IP), capture size 65535 bytes
20:10:59.532401 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 1, length 64
20:11:00.531604 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 2, length 64
20:11:01.531606 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 3, length 64
20:11:01.858483 IP6 2404:6800:4005:802::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 3, length 64
20:11:02.532339 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 4, length 64
20:11:02.859174 IP6 2404:6800:4005:802::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 4, length 64
20:11:03.534006 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 5, length 64
20:11:03.864169 IP6 2404:6800:4005:802::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 5, length 64
20:11:04.534990 IP6 2001:470:c:6c3::2 > 2404:6800:4005:802::200e: ICMP6, echo request, seq 6, length 64
20:11:04.861923 IP6 2404:6800:4005:802::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 6, length 64
^C
10 packets captured
10 packets received by filter
0 packets dropped by kernel
[root@zstest ~]# 

至此,linux-net-tools模式就配置成功了

(2)模式2:linux-router2模式

在阿里雲服務器執行如下命令:

modprobe ipv6
ip tunnel add he-ipv6 mode sit remote 66.220.18.42 local 10.10.1.151 ttl 255
ip link set he-ipv6 up
ip addr add 2001:470:c:6c3::2/64 dev he-ipv6
ip route add ::/0 dev he-ipv6
ip -f inet6 addr

# 注意:local後面網站默認生成的是阿里雲公網的地址,是沒法使用的,須要修改爲對應的內網地址,這裏是10.10.1.151

# 查看ip信息,發現多了1個網卡:he-ipv6
# he-ipv6是隧道的客戶端IP,也就是上面的「Client IPv6 Address:」

ifconfig 
ip address list
-------------------------
[root@zstest ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:16:3E:06:E2:CA  
          inet addr:10.10.1.151  Bcast:10.10.1.255  Mask:255.255.255.0
          inet6 addr: fe80::216:3eff:fe06:e2ca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:16047 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13006 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1592602 (1.5 MiB)  TX bytes:9693068 (9.2 MiB)

he-ipv6   Link encap:IPv6-in-IPv4  
          inet6 addr: 2001:470:c:6c3::2/64 Scope:Global
          inet6 addr: fe80::a0a:197/128 Scope:Link
          UP POINTOPOINT RUNNING NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:6893 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6893 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:441950 (431.5 KiB)  TX bytes:441950 (431.5 KiB)

[root@zstest ~]# ip address list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:16:3e:06:e2:ca brd ff:ff:ff:ff:ff:ff
    inet 10.10.1.151/24 brd 10.10.1.255 scope global eth0
    inet6 fe80::216:3eff:fe06:e2ca/64 scope link 
       valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noqueue state DOWN 
    link/sit 0.0.0.0 brd 0.0.0.0
8: he-ipv6: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1480 qdisc noqueue state UNKNOWN 
    link/sit 10.10.1.151 peer 66.220.18.42
    inet6 2001:470:c:6c3::2/64 scope global 
       valid_lft forever preferred_lft forever
    inet6 fe80::a0a:197/128 scope link 
       valid_lft forever preferred_lft forever
------------------------

# 使用如下命令能夠查看IPv6的路由信息

route -A inet6
------------------------
[root@zstest ~]# route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
2001:470:c:6c3::/64                         *                                       U     256    0        0 he-ipv6 
fe80::/64                                   *                                       U     256    0        0 eth0    
fe80::/64                                   *                                       U     256    0        0 he-ipv6 
*/0                                         *                                       U     1024   0        0 he-ipv6 
localhost/128                               *                                       U     0      0        1 lo      
ipv6.zuiyoujie.com/128                      *                                       U     0      0        1 lo      
fe80::a0a:197/128                           *                                       U     0      0        1 lo      
fe80::216:3eff:fe06:e2ca/128                *                                       U     0      0        1 lo      
ff00::/8                                    *                                       U     256    0        0 eth0    
ff00::/8                                    *                                       U     256    0        0 he-ipv6 
-----------------------

接下來使用ping6命令測試隧道的聯通性

[root@zstest ~]# ping6 ipv6.google.com  
PING ipv6.google.com(hkg07s21-in-x0e.1e100.net) 56 data bytes
64 bytes from hkg07s21-in-x0e.1e100.net: icmp_seq=1 ttl=56 time=352 ms
64 bytes from hkg07s21-in-x0e.1e100.net: icmp_seq=2 ttl=56 time=352 ms
64 bytes from hkg07s21-in-x0e.1e100.net: icmp_seq=3 ttl=56 time=356 ms
64 bytes from hkg07s21-in-x0e.1e100.net: icmp_seq=4 ttl=56 time=352 ms
^C
--- ipv6.google.com ping statistics ---
5 packets transmitted, 4 received, 20% packet loss, time 4052ms
rtt min/avg/max/mdev = 352.681/353.712/356.706/1.875 ms
[root@zstest ~]# 

使用tcpdump抓包以下:

[root@zstest ~]# tcpdump -nn  -i he-ipv6
tcpdump: WARNING: he-ipv6: no IPv4 address assigned
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on he-ipv6, link-type RAW (Raw IP), capture size 65535 bytes
20:20:52.308875 IP6 2001:470:c:6c3::2 > 2404:6800:4005:800::200e: ICMP6, echo request, seq 1, length 64
20:20:52.661535 IP6 2404:6800:4005:800::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 1, length 64
20:20:53.310354 IP6 2001:470:c:6c3::2 > 2404:6800:4005:800::200e: ICMP6, echo request, seq 2, length 64
20:20:53.663056 IP6 2404:6800:4005:800::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 2, length 64
20:20:54.311855 IP6 2001:470:c:6c3::2 > 2404:6800:4005:800::200e: ICMP6, echo request, seq 3, length 64
20:20:54.668535 IP6 2404:6800:4005:800::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 3, length 64
20:20:55.313331 IP6 2001:470:c:6c3::2 > 2404:6800:4005:800::200e: ICMP6, echo request, seq 4, length 64
20:20:55.666041 IP6 2404:6800:4005:800::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 4, length 64
20:20:56.314835 IP6 2001:470:c:6c3::2 > 2404:6800:4005:800::200e: ICMP6, echo request, seq 5, length 64
20:20:56.667574 IP6 2404:6800:4005:800::200e > 2001:470:c:6c3::2: ICMP6, echo reply, seq 5, length 64
^C
10 packets captured
10 packets received by filter
0 packets dropped by kernel

這種模式下,依然能夠ping6通,注意修改生成的IP便可

兩種模式的對比:

1)操做方面:模式1的方法比模式2的簡單,模式2的須要修改IP地址,推薦使用

2)網卡條目:模式1建立的網卡項目比模式2建立的多

3)路由條目:模式1建立的路由條目比模式2建立的多

3.配置IPv6的網站進行調試

可使用nginx提供IPv6的網站訪問,

3.1.配置IPv6域名解析記錄

因爲要進行頁面的訪問,須要在阿里雲對域名進行相應的解析,添加IPv6的AAAA記錄

 

3.2.保證nginx安裝完成,配置好

nginx的安裝優化就不演示了,下載地址以下:

http://nginx.org/download/nginx-1.8.0.tar.gz

個人是源碼編譯安裝的,編譯參數以下:注意須要添加IPv6的支持

./configure --prefix=/usr/local/nginx  --user=nginx --group=nginx --with-http_stub_status_module --with-http_ssl_module --with-ipv6

3.3.編輯好頁面文件

cd /usr/local/nginx/html/
cp index.html index.html.ori
vim index.html
-------------------------
ipv6.zuiyoujie.com
-------------------------

3.4.編輯nginx相關配置文件,提供ipv6訪問

vim ipv6.zuiyoujie.com.conf
-------------------------
# ipv6web
server {
   listen   [2001:470:c:6c3::2]:80;
   server_name ipv6.zuiyoujie.com;
   charset utf-8;
   location / {
      root   html;
      index  index.html index.htm;
   }
}
-------------------------

3.5.重啓nginx進行頁面訪問測試

service nginx reload

3.6.IPv6網站的測試方法

1)linux命令-curl

[root@zstest extra]# curl -6 ipv6.zuiyoujie.com
ipv6.zuiyoujie.com

2)linux命令-wget

[root@zstest extra]# wget -6 ipv6.zuiyoujie.com
--2018-06-27 21:25:48--  http://ipv6.zuiyoujie.com/
Resolving ipv6.zuiyoujie.com... 2001:470:c:6c3::2
Connecting to ipv6.zuiyoujie.com|2001:470:c:6c3::2|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 19 [text/html]
Saving to: 「index.html」

100%[======================================>] 19          --.-K/s   in 0s      

2018-06-27 21:25:48 (5.32 MB/s) - 「index.html」 saved [19/19]

[root@zstest extra]# cat index.html 
ipv6.zuiyoujie.com

3)使用網頁版的IPv6測試工具

http://ipv6-test.com/validate.php

由綠色的框裏的信息可知,IPv6的訪問能夠成功

至此,阿里雲服務器對於IPv6的網站支持就配置好了,能夠完美支持蘋果爸爸對app的IPv6檢測

拓展: 對於早期的阿里雲服務器,以上方法沒法成功配置IPv6的隧道

緣由:早期的阿里雲服務器內外網IP地址都配置在服務器內部,以下

若是是這種類型的服務器,在使用模式1的方法配置後,sit0和sit1的IPv6地址會多增長一個,以下圖

配置完成進行測試,使用如下命令測試與Google的聯通性:

ping6 ipv6.google.com

能夠看到能成功解析到,但沒有徹底ping通,使用tcpdump抓包:

 

只有去的包,沒有回的包,查看路由表

[root@zstest ~]# route -A inet6
Kernel IPv6 routing table
Destination                                 Next Hop                                Flags Metric Ref    Use Iface
*/96                                        *                                       U     256    0        0 sit0    
2001:470:c:6c3::/64                         *                                       U     256    0        0 sit1    
google-public-dns-a.google.com/128          google-public-dns-a.google.com          UC    0      1        0 sit1    
hkg07s01-in-x0e.1e100.net/128               hkg07s01-in-x0e.1e100.net               UC    0      90       0 sit1    
fe80::/64                                   *                                       U     256    0        0 eth0    
fe80::/64                                   *                                       U     256    0        0 eth1    
fe80::/64                                   *                                       U     256    0        0 sit1    
*/0                                         *                                       U     1      0        0 sit1    
localhost/128                               *                                       U     0      0        1 lo      
::10.44.202.10/128                          *                                       U     0      0        1 lo      
::101.200.230.217/128                       *                                       U     0      0        1 lo      
localhost/128                               *                                       U     0      0        1 lo      
tunnel483503-pt.tunnel.tserv15.lax1.ipv6.he.net/128 *                                       U     0      11       1 lo      
fe80::a2c:ca0a/128                          *                                       U     0      0        1 lo      
fe80::65c8:e6d9/128                         *                                       U     0      0        1 lo      
fe80::216:3eff:fe03:a015/128                *                                       U     0      0        1 lo      
fe80::216:3eff:fe2e:ab15/128                *                                       U     0      0        1 lo      
ff00::/8                                    *                                       U     256    0        0 eth0    
ff00::/8                                    *                                       U     256    0        0 eth1    
ff00::/8                                    *                                       U     256    0        0 sit1    
[root@zstest ~]# 

嘗試禁用掉某個網卡進行配置,也沒法解決這個

ifdown eth1
ifconfig sit0 up
ifconfig sit0 inet6 tunnel ::66.220.18.42
ifconfig sit1 up
ifconfig sit1 inet6 add 2001:470:c:6c3::2/64
route -A inet6 add ::/0 dev sit1
ifup eth1

eth0和eth1都不成功,且會臨時斷掉服務器鏈接,測試前須要確承認以直接鏈接到控制檯命令行

以上問題比較難解決,不太擅長,有興趣的能夠研究下

 

完畢,呵呵呵呵

相關文章
相關標籤/搜索