Menu
Coddy logo textTech

When Ping Lies

Lesson 17 of 47 in Coddy's Networking with the Terminal course.

Ping is the first thing everyone reaches for, and it answers a narrower question than people think. It tells you the machine is alive. It says nothing about whether the thing you actually want is running.

A server can answer every ping perfectly while the web server on it has crashed. The machine is up; the service is down. Ping cannot see the difference, because it never talks to the service.

It lies in the other direction too. Plenty of hosts are configured to ignore ICMP entirely, so ping reports 100 percent loss for a machine that is serving traffic happily. A failed ping is not proof that anything is wrong.

So ping is step one of a ladder, never the whole diagnosis. Step two is asking the port itself.

challenge icon

Challenge

Medium

Show the exact situation ping cannot see: a machine that answers, with nothing serving on the port.

Against 127.0.0.1, and starting no server at all:

  1. Ping once and print host up
  2. Check port 9999 with nc -z and print port closed

Expected output:

host up
port closed

The machine is obviously alive. That is exactly the point: alive is not the same as serving.

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Networking with the Terminal

Practice on your own: Terminal playground