An IPv6 is a preferred protocol over IPv4 in modern Windows and Linux systems.
In Linux, you can ping
IPv6 addresses using a standard ping
command as well as a special ping6
command.
This short note shows how to ping
the IPv6 addresses in Linux.
Cool Tip: How to disable an IPv6 support in Linux! Read more →
Ping IPv6 Address in Linux
Use one of these commands to ping
the IPv6 addresses in Linux:
$ ping <ipv6-address-or-hostname> $ ping -6 <ipv6-address-or-hostname> $ ping6 <ipv6-address-or-hostname>
For example, to ping
the IPv6 address 2001:4860:4860::8888
(Google Public DNS), execute one of the commands below:
$ ping 2001:4860:4860::8888
$ ping -6 2001:4860:4860::8888
$ ping6 2001:4860:4860::8888
- sample output -
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
64 bytes from 2001:4860:4860::8888: icmp_seq=1 ttl=113 time=66.6 ms
...
You can also use these commands to ping
a hostname that resolves to the IPv6 address (DNS has the AAAA
record), for example:
$ ping google.com
$ ping -6 google.com
$ ping6 google.com
- sample output -
PING google.com(x0e.net (2a00:1450:4007:80e::200e)) 56 data bytes
64 bytes from x0e.net (2a00:1450:4007:80e::200e): icmp_seq=1 ttl=113 time=41.8 ms
...
If you want to enforce the IPv4 hostname resolution, execute:
$ ping -4 google.com
$ ping4 google.com
- sample output -
PING google.com (172.217.18.206) 56(84) bytes of data.
64 bytes from f14.net (172.217.18.206): icmp_seq=1 ttl=114 time=30.6 ms
...
Check if IPv6 Support is Enabled
If the IPv6 protocol is not supported by the source device (e.g. your computer), the ping
and ping6
commands will return the message as follows:
$ ping 2001:4860:4860::8888
- sample output -
ping: connect: Network is unreachable
You can also check if the IPv6 support is enabled by running the ip -6 route
command:
$ ip -6 route
- sample output -
::1 dev lo proto kernel metric 256 pref medium
The output about indicates that the IPv6 support is not enable on your system.
To enable it, check the IPv6 setting of your network card.
If the IPv6 support on your system is enabled, the ip -6 route
command should return something like:
$ ip -6 route
- sample output -
::1 dev lo proto kernel metric 256 pref medium
2a02:8440:3240:b662::/64 dev wlp2s0 proto ra metric 600 pref medium
fe80::/64 dev wlp2s0 proto kernel metric 600 pref medium
default via fe80::2064:51ff:feda:bf27 dev wlp2s0 proto ra metric 600 pref high
If the IPv6 protocol is not supported by your router or the target devices, the ping
and ping6
commands will report the “100% packet loss”:
$ ping 2001:4860:4860::8888
- sample output -
PING 2001:4860:4860::8888(2001:4860:4860::8888) 56 data bytes
^C
--- 2001:4860:4860::8888 ping statistics ---
94 packets transmitted, 0 received, 100% packet loss, time 95223ms
Cool Tip: How to find out a router’s IP address! Read more →