Ping and trace are a utility for testing the network connectivity and availability of the device. Both are using ICMPv4 and ICMPv6 echo request and echo reply for testing. In this article, we will briefly discuss both ping and trace.
It is the abbreviation of Packet InterNet Groper. We can send both IPv4 and IPv6 echo request to test connectivity and availability of to another host on a local network or remote network. The echo request is sent to the address of 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 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 performance of the network.
If an echo reply is not received within a given time period, it provides a message which indicates that a response was not received from the destination host. Typically timeout indicates a problem with the remote host or with the network.
In some cases, it may be caused due to security features which block ping messages on the network. After all the ping requests have sent to the destination, the utility provides a detailed summary about 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 f localhost is unable to connect 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 successful, it’s mean that the TCP/IP is properly installed on the host. Although this response is not a sign that the addresses, masks, or gateways are properly configured. These simple tests IP down through the network layer of IP and have no indication about the status of the lower layer of the network stack. If an error message received, it’s mean that TCP/IP is not operational on the host. The figure below illustrates the loopback ping for both IPv4 and IPv6 addresses.
Testing Connectivity Local Area Network
We can test and verify the host connectivity to local LAN using the ping command. A successful ping to the gateway meaning 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 that is known to be operational.
If one of both gateway and another host responds then 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 an internetwork. 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 network of the remote host. Successful ping to remote host also verifies the availability and connectivity of the remote host. If the remote 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 to the destination successfully, then 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 path, the address of the last router that responded to the trace can provide an indication of where the problem or security restrictions are found.
Round Trip Time (RTT)
The traceroute also provide round trip time for each hop along the path and also show the hops which do not respond. The round trip time is the time a packet takes to reach the remote host and for acknowledge from the host to return. An asterisk (*) is used to indicate a loss or un-replied 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 there is something wrong with the resources of the router or its connectivity.
IPv4 TTL and IPv6 Hop Limit
The first series of messages sent from 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.