How to Ping IPv6 Addresses

Using the ping command is perhaps the most common way to check if a remote server is reachable or not.

By default, the ping command works on the IPv4 address. But what if you need to ping an IPv6 address?

The answer is that you still use the ping command. Yes, the newer versions of the ping command support IPv6 addresses.

ping IPv6_address

If you have a domain name and you want to get the replies from the IPv6, use the ping command like this:

ping -6 domain_name

Alternatively, you can always rely on the ping6 command:

ping6 ipv6_address_or_domain_name

To successfully ping IPv6 addresses, you need the complete IPv6 flow from that target to your local system.

  • The target should have IPv6 enabled
  • The source and its router should also have IPv6 enabled

Check if you have IPv6 support enabled on your system

To successfully ping an IPv6 address, you also need to have IPv6 enabled on your local system, too. Otherwise, if you try to ping for an IPv6 reply, you'll get 'ping: connect: network is unreachable' error.

sagar@LHB:~$ ping -6 google.com
ping: connect: Network is unreachable

How do you know if you have IPv6 support on your system? Use this command and observe its output:

ip -6 route

This will give the route information for the IPv6 traffic. If you see "default via" in the output, you have a gateway IP set for IPv6:

root@test-server:~# ip -6 route
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev eth0 proto kernel metric 256 pref medium
default via fe80::1 dev eth0 proto ra metric 1024 expires 1774sec mtu 1500 pref medium

If you see something like this without any information on the route, you don't have IPv6 support enabled. You should enable it first.

sagar@LHB:~$ ip -6 route
::1 dev lo proto kernel metric 256 pref medium
fe80::/64 dev wlp0s20f3 proto kernel metric 1024 pref medium

Once you ensure that your local system has IPv6 support, let's see a thing or two about pinging IPv6 addresses.

Pinging an IPv6 Address using ping command

If you ping a domain, by default, it pings the IPv4 address. Something like this:

The default way of pinging network addresses 

As per the man page of the ping command, you can use -6 option to force the ping command to go for IPv6 addresses.  

ping -6 domain_name

For example, I'd be using the exact address so that you can notice the change in the address that sends the replies.

Using the -6 option to ping IPv6 network address

Saw the difference in address? You are getting replies from the IPv6 address this time.

That's good with domain names. What if you only have the IPv6 address?

Using Full IPv6 Address

The method is quite easy, append IPv6 address with ping command. yep, that's it!

ping IPv6_address

IPv6 address of Linuxhandbook is 2606:4700:20::681a:c82, so I'd be using this for example:

Using ping command with IPv6 address 
How to Find IP Address in Linux Command Line
How do I find out the IP address of in Linux ? It’s a common question for a number of Linux users. Here are multiple ways to get the IP of host system in Linux.

Using ping6 command to ping IPv6

Earlier, ping command could only use the IPv4 addresses and thus a separate utility called ping6 was created.

On some older Linux versions, ping may not work for IPv6. If that's the case, use ping6 instead.

ping6 domain_or_IPv6_address
Using the ping6 command to ping the IPv6 address

Final Words

I don't see the need for using ping6. The ping command has always been my go-to choice while troubleshooting networking issues. I prefer using it for IPv6 as well. One less command to remember.

Feel free to share your ideas and doubts.