Ping lets you test if a host is reachable and the average time taken for a data packet to reach the host. It’s one of the most useful tools for troubleshooting network connectivity problems. Pretty much all operating systems use some implementation of ping, and Ubuntu is no exception. We’ll cover its basic usage on Ubuntu, as well as how you can interpret ping results in this article. Ping Syntax The basic syntax for ping is ping <hostname/IP> ping 192.168.10.35 ping linuxstart.com By default, this will start sending ICMP ECHO_REQUESTs to the specified host. On Ubuntu, the pings will continue until you send an interrupt signal (Ctrl + C) to stop them. Understanding Ping Results Once you stop the pings, you’ll get a summary of the ping stats. If you pinged using the hostname, you’ll see it has been resolved to the IP address at the top. Next, you’ll see the number of data bytes sent. Add the ICMP header data to that and that’s the value inside the brackets. Next, you can see the reply for each ICMP packet sent along with the Round Trip Time (RTT). At the bottom, you’ll see the total packets transmitted, received, and the packet loss %. The average RTT is also a useful stat. Ping Options So far, we’ve only covered how Ping operates by default. You can use various options to change its behavior. For instance, users sometimes face packet loss with larger-sized packets only. You may not be able to diagnose this with the default 64-byte packages. In such cases, you can specify the packet size (in bytes) with the -s option. ping -s 4000 192.168.10.1 If you want the pings to stop after a certain count rather than continue indefinitely, you can use the -c flag. ping -c 7 192.168.10.1 Using Ping to Troubleshoot Network Issues Perhaps you can’t access an SSH server, or maybe your internet connection isn’t working. Ping is useful for troubleshooting these and a host of other networking problems. If you’re not sure what the problem is, you can start by pinging your default gateway. There should be little to no packet loss between your device and the gateway. If extensive packet loss is found, you should fix that first. Assuming the connection between the device and router is good, you can start looking outward. For instance, pinging a host can fail, often citing errors such as Request timed out. Aside from packet loss, this typically happens because a firewall is blocking the connection, or because the host is offline.