Ping and Traceroute

Ping and trace are utilities for testing the network connectivity and availability of the device. Both use ICMPv4 and ICMPv6 echo requests and echo replies for testing. In this article, we will briefly discuss both ping and trace.

Ping

It is the abbreviation of Packet InterNet Groper. We can send both IPv4 and IPv6 echo requests to test connectivity and availability to another host on a local or remote network. The echo request is sent to the address of the destination host using the “ping” command.

If the host at the particular address receives the echo request, it responds with an echo reply. As each echo reply is received, ping gives feedback on the time between the echo requests, sending an echo reply receiving time. This time can be used to calculate the network’s performance.

If an echo reply is not received within a given period, it provides a message which indicates that a response was not received from the destination host. Typically, a timeout suggests a problem with the remote host or the network.

In some cases, it may be caused by security features that block ping messages on the network. After all the ping requests have been sent to the destination, the utility provides a detailed summary of the success, losses, and average round-trip time to the destination.

Pinging the Loopback Addresses

We can also troubleshoot the localhost problem with the help of the “ping” command.  For example, if the localhost cannot connect to the network resources, then we can test and verify the internal configuration of IPv4 or IPv6 on the localhost using the ping command. To perform this initial test, we ping the local loopback address of 127.0.0.1 for IPv4 and (::1 )for IPv6.

A response from 127.0.0.1 for IPv4, or (::1) for IPv6, is booming; the TCP/IP is correctly installed on the host. However, this response does not indicate that the addresses, masks, or gateways are correctly configured. These simple tests IP down through the network layer of IP and do not indicate the status of the lower layer of the network stack. If an error message is received, TCP/IP is not operational on the host.  The figure below illustrates the loopback ping for both IPv4 and IPv6 addresses.

ping

Testing Connectivity Local Area Network

We can test and verify the host’s connectivity to the local LAN using the ping command. A successful ping to the gateway means that the host and the router interface serving as the gateway are both operating on the local network. Usually, the router interface is working as a gateway. If the gateway address does not respond, we can send the ping to the IP address of another host on the local network known to be operational.

If one of the gateway and another host responds, the local host can communicate over the local network. If the gateway does not respond but another host responds, this indicates some problem with the router interface serving as the gateway.

Maybe the gateway address configured by the host is not correct. Another option is that the router interface may be fully operational with security applied to it that prevents it from processing or responding to ping requests. The figure below illustrates the ping result to my default gateway.

Testing Connectivity to Remote Network

Ping can also use the ping command to test the capability of localhost to communicate across the internet. The local host can ping an operational IPv4 host of a remote network. If the ping is successful, most of the network can be verified.

Ping also verifies communication on the local network,  the function of the router serving as the gateway, and the function of all other routers that might be in the path between the local network and the remote host network. Successful pings to the remote host also verify the remote host’s availability and connectivity. If the remote had not allowed communication outside of its local network, it would not have responded. The figure illustrates my remote ping result.

Traceroute or Tracert  

Traceroute or tracert provide information about the devices between the two hosts. It generates a list of hops along the path to the destination. The list generated by traceroute provides important information for verification and troubleshooting of the network.

If the traceroute reaches the destination successfully, the utility provides a complete list of the interfaces of every router in the path between the two hosts. If the trace fails at some hop along the route, the address of the last router that responded to the trace can indicate where the problem or security restrictions are.

Round Trip Time (RTT)

The traceroute also provides round-trip time for each hop along the path and shows the hops that do not respond. The round-trip time is the time a packet takes to reach the remote host and for acknowledgement from the host to return. An asterisk (*) is used to indicate a lost or unreplied packet.

This information is important to locate a problematic router in the path to the remote host. If there are high response times or data losses from a particular hop, this is an indication that something is wrong with the router’s resources or connectivity.

IPv4 TTL and IPv6 Hop Limit

Traceroute also used the TTL field in IPv4 and the Hop Limit in IPv6 in the layer 3 header, including the ICMP time exceeded message. The figure below illustrates the traceroute to https://gmail.com.

The first series of messages from the traceroute will have a TTL field value of 1. This causes the TTL to time out the IPv4 packet at the first router. This router then replies with an ICMPv4 message. Traceroute now displays the IP address of the first hop.

Traceroute then gradually increase the TTL field to 2, 3, 4, 5, 6… for each series of messages and provides the trace with the IP address of each hop as the packets time out further down the path. The TTL field continues to be increased until the destination is reached. After reaching the final destination, the host responds with either an ICMP port unreachable message or an ICMP echo reply message instead of the ICMP time exceeded message.