ping
Overview
The ping
command sends ICMP ECHO_REQUEST packets to network hosts. It’s used to test network connectivity and measure round-trip time.
Syntax
ping [options] destination
Common Options
Option | Description |
---|---|
-c count |
Stop after count |
-i interval |
Seconds between pings |
-s size |
Packet size |
-t ttl |
Time to live |
-W timeout |
Time to wait |
-q |
Quiet output |
-v |
Verbose output |
-4 |
IPv4 only |
-6 |
IPv6 only |
-f |
Flood ping |
-n |
Numeric output |
-R |
Record route |
Key Use Cases
- Network testing
- Host availability
- Latency measurement
- Route testing
- DNS verification
Examples with Explanations
Example 1: Basic Ping
ping google.com
Test connectivity
Example 2: Limited Count
ping -c 4 192.168.1.1
Send 4 packets
Example 3: Different Size
ping -s 1000 host
Use larger packets
Common Usage Patterns
Quick test:
ping -c 1 host
Continuous monitoring:
ping -i 60 host
Detailed output:
ping -v host
Output Interpretation
- Round-trip time
- Packet loss
- Statistics
- Error messages
- Route information
Additional Resources
Best Practices
- Use timeouts
- Limit count
- Check permissions
- Monitor results
- Document tests
Security Considerations
- ICMP blocking
- Firewall rules
- Rate limiting
- Flood protection
- Access control
Troubleshooting
- No response
- High latency
- Packet loss
- DNS issues
- Route problems
Common Error Messages
- Network unreachable
- Host unreachable
- Permission denied
- Unknown host
- Request timeout