brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: ping -O -D shows exactly when a Linux network connection drops replies

Linux
~/tips/tip-linux-ping-o-d-missed-replies

ping -O -D 192.0.2.1

Log each missing reply with a timestamp, so short outages become visible.

A normal ping says nothing when a reply goes missing. It just skips a sequence number, and in a long run you will never spot that gap.

ping -O -D 192.0.2.1

The man page describes -O as reporting an outstanding reply before the next packet is sent. In practice you get a line like no answer yet for icmp_seq=42 each time a reply does not come back in time. -D puts a Unix timestamp in front of every line, so you can later match a gap to a log entry on your router or server.

I’d leave it writing to a file while you try to reproduce a problem:

ping -O -D 192.0.2.1 | tee ping.log
grep -c 'no answer' ping.log

The count tells you how many replies went missing, and the timestamps tell you when.

To turn a timestamp into a readable date, run date -d @1764500000 with the number before the dot.

-O is a feature of the iputils ping that most Linux distributions ship. BusyBox ping and the macOS version do not have it. Also keep in mind that a missing ICMP reply is not always a network problem; some routers give ICMP a low priority when they are busy, so test against a host that answers ping reliably.

Further reading: ping(8) manual page

More Linux tips a2query -m rewrite renice -n 10 -p 4242 cat config.yml | xsel -ib xvfb-run -a your-program --some-flag dpkg --get-selections > packages.txt All Linux tips (261) All topics

Link