How to ping IPv6 addresses
ping is commonly known as the tool for pinging IP addresses. For example:
$ $ ping 127.0.0.1 PING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.066 ms 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.072 ms ^C --- 127.0.0.1 ping statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 0.066/0.069/0.072/0.003 ms
However, trying to ping an IPv6 address fails:
$ ping ::1 ping: cannot resolve ::1: Unknown host
"Maybe I should enclose the address within square brackets?"
$ ping [::1] ping: cannot resolve [::1]: Unknown host
Nah, that's required only when IPv6 addresses are used in a URL context.
How to ping IPv6 addresses#
The command for pinging IPv6 address is
ping6. Let's ping
localhost using its IPv6 address:
$ ping6 ::1 PING6(56=40+8+8 bytes) ::1 --> ::1 16 bytes from ::1, icmp_seq=0 hlim=64 time=0.053 ms 16 bytes from ::1, icmp_seq=1 hlim=64 time=0.120 ms ^C --- ::1 ping6 statistics --- 2 packets transmitted, 2 packets received, 0.0% packet loss round-trip min/avg/max/std-dev = 0.053/0.086/0.120/0.034 ms
-6flag of the
ping -6 ::1
Now let's try pinging an external IPv6 address. Let's ping facebook.com's IPv6 address (
$ ping6 2a03:2880:f12f:83:face:b00c::25de ping6: UDP connect: No route to host
"ping6: UDP connect: No route to host?"
We will need to specify the network interface. On Macs, it will either be
en0. On Linux, it is very likely
$ ping6 -I en1 2a03:2880:f12f:83:face:b00c::25de
In case, you get "ping6: sendmsg: No route to host", something in your system or router needs to be configured for IPv6. Once configured, you will be able to ping IPv6 addresses using
To ping IPv6 addresses, use the
ping6 command along with the interface option
ping -I en1 2a03:2880:f12f:83:face:b00c::25de.