Linux Commands

How to Ping IPv6 on Linux

IPv6 (Internet Protocol version 6) was developed to replace IPv4 due to the expansion of IoT and the limited number of IP addresses in IPv4. In the internet session, a ping measures the complete round-trip for the packet between the host and the destination. Pinging a network device is a common troubleshooting step to check the internet connection. However, many beginners need to learn how to ping IPv6 or IPv4 in Linux distros. This short tutorial explains the simple ways to ping IPv6 on Linux.

How to Ping IPv6 on Linux

A ping is a popular tool to troubleshoot the network connectivity issues within a remote system. You can use the ping command with a variety of protocols and networks. The network infrastructure and the internet primarily use IPv4 as the network layer. At the same time, the new generational IPv6 is becoming popular due to its immense power and compatibility.

You can use the ping command for both IPv4 and IPv6. Here, we look at specifically pinging ipv6. For this, follow these steps:

First, check whether your system supports IPv6.

ip -6 route

When you run the previous command, you see the “default via” in the output which means that you have a gateway IP set for IPv6. If it is not in the output, your system does not support IPv6.

To successfully ping an IPv6 address, you must enable the IPv6 on the system. If it is not enabled and you are trying to ping for IPv6, it will give you a “ping: connect: network unreachable” error.

Now, verify if IPv6 is enabled or not using the following command:

ping6 ipv6.google.com

If your output is similar to the previous output, it means that IPv6 support is not enabled. In this case, you have to enable it first.

Now, you can ping IPv6 with the ping command. Although this command works with IPv4 addresses by default, you can also use it for IPv6 addresses.

Condition 1: Ping IPv6 with the Domain Name

You can use the ping command with the domain name to ping the address. But by default, it gives you the IPv4 address. To ping the IPv6 address using the ping command through the domain name, use the “-6” option to force the IPv6 address:

ping -6 <domain_name> (for Arch Linux and Red Hat-based distros)

Or

ping6 <domain_name> (for Debian-based distros, including Ubuntu)

Condition 2: Ping IPv6 with IPv6 Address

If you don’t have a domain name or hostname, you can use the ping command with the IPv6 address as follows:

ping <IPv6_address>
Or
ping6 <IPv6_address>

You can also ping the IPv6 address which is directly hosted by the server. For this, use the following command:

ping6 ipv6.google.com
Or
ping -6 ipv6.google.com

Conclusion

We explained the methods to ping an IPv6 address on Linux. Many Linux systems have both IPv4 and IPv6 addresses. In this condition, it is essential to ping IPv6 for connectivity. You can also ping the IPv6 address which is hosted by Google. We hope that with the help of this guide, you can successfully ping the IPv6 addresses on your Linux device.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.