Ping
Table of Contents
Network diagnostic utility. Sends ICMP Echo Request packets to a target host and measures the round-trip time (RTT) of the reply. The fastest way to confirm a host is reachable and estimate latency.
Related: ICMP Traceroute Network Discovery Nmap
Usage
# Basic ping ping $IP # Send a fixed number of packets then stop (Linux) ping -c 4 $IP # Send a fixed number of packets (Windows) ping -n 4 $IP # Set packet size (bytes) ping -s 1000 $IP # Set interval between packets (seconds, default 1) ping -i 0.2 $IP # faster — 5 packets per second # Flood ping — maximum speed, requires root (use carefully) ping -f $IP # Set TTL ping -t 64 $IP # Windows: sets TTL ping --ttl 64 $IP # Linux # Continuous ping (Windows default behaviour) ping -t $IP # IPv6 ping6 $IP ping -6 $IP
Reading Output
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data. 64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.432 ms 64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.418 ms --- 192.168.1.1 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1001ms rtt min/avg/max/mdev = 0.418/0.425/0.432/0.007 ms
| Field | Meaning |
|---|---|
ttl |
Time To Live — decremented at each hop; OS fingerprinting clue |
time |
Round-trip time in milliseconds |
packet loss |
Percentage of packets with no reply — indicates drops |
mdev |
Mean deviation — consistency of latency |
TTL OS Fingerprinting
Default TTL values differ by OS — visible in ping replies:
| TTL | Likely OS |
|---|---|
| 64 | Linux / macOS |
| 128 | Windows |
| 255 | Cisco / network devices |
TTL decrements by 1 at each hop, so subtract the number of hops to estimate the original value.
Security Relevance
# Host discovery — ping sweep of a subnet # Linux for i in $(seq 1 254); do ping -c 1 -W 1 192.168.1.$i & done | grep "bytes from" # More reliable with fping fping -a -g 192.168.1.0/24 2>/dev/null # Nmap ICMP ping sweep nmap -sn -PE 192.168.1.0/24 # Check if ICMP is blocked (host may still be up) # A timeout does not guarantee the host is down — firewalls often block ping # Use nmap -Pn to skip host discovery when ICMP is filtered nmap -Pn $IP
Ping being blocked or filtered is common — on TryHackMe rooms
-Pn is often needed since hosts do not respond to ICMP.
Tips
ping -c 4is the standard quick reachability check on Linux — stops automatically rather than running until Ctrl+C- High
mdev(mean deviation) indicates inconsistent latency — useful for identifying an unstable connection - A non-response to ping does not mean the host is down — firewalls frequently block ICMP while leaving TCP/UDP open
- TTL fingerprinting is a quick passive OS identification technique when active scanning is not appropriate