Ping vs. Ping6: Understanding IPv4 and IPv6 Connectivity

This article compares ping and ping6, highlighting their differences and providing syntax examples.

Introduction:

The Ping protocol is part of the ICMP family of protocols. It’s used to check the connectivity between two IP-based machines. By using ping or ping6, you can initiate a command from a source PC to determine if a destination PC is reachable. As you know, there are two main types of IP addresses assigned to devices connected to the internet: IPv4 and IPv6.

ping request and ping response

Ping Request and Ping Response

The main difference between ping and ping6 is that ping is associated with IPv4, whereas ping6 is associated with IPv6.

Ping Command (IPv4)

The following table outlines the syntax and usage of the ping command, which is used with IPv4 addresses.

When a ping command is issued from a source PC, it sends a series of bytes along with a header to the destination PC. The destination PC replies with a “ping response,” copying all the data received in the ping request into the payload of the response. The source PC then compares the received data with the transmitted data to calculate packet loss as a percentage.

Ping Command FormatDescription
# ping w.x.y.zChecks for layer-3 connectivity with the IP device having the address w.x.y.z.
# ping 172.168.20.1Performs a basic layer-3 test to a device with the IP address 172.168.20.1.
# ping GuruSimilar to above, but pings the system using its IP hostname rather than its IP address. The system must be configured correctly for hostname resolution (e.g., via DNS or a local hosts file) for this to work.

Ping6 Command (IPv6)

Table 2 provides the syntax and usage descriptions for the ping6 command.

We can also use ping6 to check if a host or server supports IPv6. Another similar command is traceroute6, used to check reachability and the route taken.

Ping6 Command formatDescription
# ping6 <hostwithipv6address> ping6 www.ipv6tf.orgPings the specified IPv6 host by its address or domain name.
# ping6 <ipv6address>Pings the specified IPv6 address.
ping6 fe80::e8a7:b568:a076:6ba3Pings the link-local address.
ping6 fe80::200:87ff:fe28:a0e0%5Pings a neighbor’s link-local address on interface 5.
ping6 [-I <device>] <link-local-ipv6address>Specifies the interface to use when pinging a link-local IPv6 address.
ping6 -I eth0 fe80::21e:52ff:fe73:c2a6Pings a link-local address on the eth0 interface.
ping6 <link-local-ipv6address>%<device>Pings a link-local address, explicitly specifying the interface.
ping6 fe80::21e:52ff:fe73:c2a6%en1Pings a link-local address on the en1 interface.
# ping6 -I eth0 ff02::1Sends a ping6 to all IPv6 nodes on the eth0 interface using the all-nodes multicast address (ff02::1).