Knowledgebase

Find frequently asked questions and setup guides by searching or by browsing the categories.

Basic Use

ping example.com
ping -c 4 example.com
ping -c 4 203.0.113.10

On Linux, ping runs until you press Ctrl+C. -c 4 stops after four requests. Each reply line shows the size, the sender, the sequence number (icmp_seq), the TTL, and the round-trip time in milliseconds. A missing sequence number means that request got no reply.

Useful Options

OptionWhat it does
-c 10Sends 10 requests, then stops.
-i 0.5Waits 0.5 seconds between requests; default 1.
-s 1400Sets the data size in bytes; default 56.
-W 2Waits 2 seconds for each reply.
-w 30Stops after 30 seconds in total.
-4 / -6Uses IPv4 or IPv6 only.
-nShows addresses, no name lookups.
-qPrints only the summary.

Normal users cannot go below a minimum interval, which depends on the iputils version; flooding a host you do not own is not acceptable use.

Read the Summary

When ping stops, it prints two summary lines: how many packets were sent and received with the percentage lost, then the minimum, average, maximum, and deviation (mdev) of the round-trip times.

  • Packet loss: 0% is normal. Steady loss of a few percent or more causes slow pages and stalled connections.
  • Average time: depends mostly on distance. A few milliseconds within a city, tens across a continent, and well over 100 between continents.
  • Max and mdev: large swings point to congestion or an overloaded link somewhere on the path.

For a meaningful number, send more requests, such as -c 50, and test at different times of day.

When There Is No Reply

A host that does not answer ping may still be up. Many servers, routers, and cloud firewalls drop ICMP echo requests. Test the service itself instead: nc -zv example.com 443 checks a TCP port, as shown in the nc command, and curl -I https://example.com checks a website.

  • Name not resolved: ping fails before sending anything; the problem is DNS. See temporary failure in name resolution.
  • Destination unreachable: a router or the local system reports there is no way to the address; check routes with ip r.
  • Silence with no error: the requests leave but nothing comes back; a firewall or a routing problem along the way.

IPv4 and IPv6

ping -4 -c 4 example.com
ping -6 -c 4 example.com

When a name has both A and AAAA records, ping may use either. Test both separately: a site that works over IPv4 but not IPv6 is slow or broken for part of its visitors. See how to configure IPv6 on a Linux server.

Find the Path MTU

ping -c 3 -M do -s 1472 203.0.113.10

-M do forbids fragmentation. 1472 bytes of data plus 28 bytes of headers make a 1500-byte packet. If this fails with an error that the message is too long or that fragmentation is needed, while smaller sizes work, the local interface or a link on the path has a smaller MTU, which can stall large transfers over VPN or tunnel links.

Allow Ping on Your Server

ufw's default rules accept echo requests for IPv4 and IPv6, and firewalld zones with the default target, such as public, accept ICMP unless you add an ICMP block. If you block ping for IPv4, never block all ICMPv6: IPv6 needs it to find neighbors and the path MTU.

Beyond ping

ping tells you whether loss exists, not where. To find the hop where it starts, use traceroute and mtr. For the other network tools, see Linux network commands.

Was this answer helpful?
Loading...