Eu habilitei o IPv6 em um servidor CentOS 7 e tudo está funcionando como esperado, exceto para o ping6: ele está exibindo 3-5 atrasos entre as solicitações (mas o RTT está bem):
$ ping6 www.google.com
<...5 sec...>
PING www.google.com(2607:f8b0:4002:c09::69) 56 data bytes
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=1 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=2 ttl=55 time=21.2 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=3 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=4 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=5 ttl=55 time=21.2 ms
<...5 sec...>
^C64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=6 ttl=55 time=21.1 ms
--- www.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 25216ms
rtt min/avg/max/mdev = 21.119/21.183/21.251/0.043 ms
Eu então o executei através do strace ( strace ping6 www.google.com
) e vejo que ele obtém um tempo limite tentando fazer o ping do endereço IPv4 e, em seguida, avança para abrir um soquete IPv6 e obtém êxito:
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("209.244.0.3")}, 16) = 0
gettimeofday({1415215545, 657352}, NULL) = 0
poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "21$ ping6 www.google.com
<...5 sec...>
PING www.google.com(2607:f8b0:4002:c09::69) 56 data bytes
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=1 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=2 ttl=55 time=21.2 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=3 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=4 ttl=55 time=21.1 ms
<...5 sec...>
64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=5 ttl=55 time=21.2 ms
<...5 sec...>
^C64 bytes from 2607:f8b0:4002:c09::69: icmp_seq=6 ttl=55 time=21.1 ms
--- www.google.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 25216ms
rtt min/avg/max/mdev = 21.119/21.183/21.251/0.043 ms
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 4
connect(4, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("209.244.0.3")}, 16) = 0
gettimeofday({1415215545, 657352}, NULL) = 0
poll([{fd=4, events=POLLOUT}], 1, 0) = 1 ([{fd=4, revents=POLLOUT}])
sendto(4, "21%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%", 32, MSG_NOSIGNAL, NULL, 0) = 32
poll([{fd=4, events=POLLIN}], 1, 5000) = 0 (Timeout)
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET6, sin6_port=htons(53), inet_pton(AF_INET6, "2001:4860:4860::8844", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
gettimeofday({1415215550, 663174}, NULL) = 0
poll([{fd=5, events=POLLOUT}], 1, 0) = 1 ([{fd=5, revents=POLLOUT}])
sendto(5, "21%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%", 32, MSG_NOSIGNAL, NULL, 0) = 32
poll([{fd=5, events=POLLIN}], 1, 3000) = 1 ([{fd=5, revents=POLLIN}])
ioctl(5, FIONREAD, [60]) = 0
recvfrom(5, "2110%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%"..., 1024, 0, {sa_family=AF_INET6, sin6_port=htons(53), inet_pton(AF_INET6, "2001:4860:4860::8844", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 60
%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%", 32, MSG_NOSIGNAL, NULL, 0) = 32
poll([{fd=4, events=POLLIN}], 1, 5000) = 0 (Timeout)
socket(PF_INET6, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5
connect(5, {sa_family=AF_INET6, sin6_port=htons(53), inet_pton(AF_INET6, "2001:4860:4860::8844", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = 0
gettimeofday({1415215550, 663174}, NULL) = 0
poll([{fd=5, events=POLLOUT}], 1, 0) = 1 ([{fd=5, revents=POLLOUT}])
sendto(5, "21%pre%%pre%%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%", 32, MSG_NOSIGNAL, NULL, 0) = 32
poll([{fd=5, events=POLLIN}], 1, 3000) = 1 ([{fd=5, revents=POLLIN}])
ioctl(5, FIONREAD, [60]) = 0
recvfrom(5, "2110%pre%%pre%%pre%%pre%%pre%%pre%wwwgooglecom%pre%%pre%%pre%"..., 1024, 0, {sa_family=AF_INET6, sin6_port=htons(53), inet_pton(AF_INET6, "2001:4860:4860::8844", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, [28]) = 60
O ping6 não deve procurar registros AAAA e abrir endereços IPv6 exclusivamente? Por que isso está acontecendo?