ping
Overview
The ping
command sends ICMP ECHO_REQUEST packets to network hosts. It’s used to test network connectivity and measure response time.
Syntax
ping [options] destination
Common Options
Option | Description |
---|---|
-c count |
Stop after count packets |
-i interval |
Seconds between packets |
-s packetsize |
Set packet size |
-q |
Quiet output |
-w deadline |
Timeout in seconds |
-4 |
IPv4 only |
-6 |
IPv6 only |
-f |
Flood ping |
-n |
Numeric output only |
-v |
Verbose output |
Key Use Cases
- Network connectivity
- Response time
- Host availability
- Network quality
- Route testing
Examples with Explanations
Example 1: Basic Usage
ping google.com
Continuous ping to Google
Example 2: Limited Count
ping -c 4 192.168.1.1
Send 4 packets only
Example 3: Custom Interval
ping -i 2 hostname
Ping every 2 seconds
Understanding Output
Example output:
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.043 ms
Components: - Packet size - Source address - Sequence number - Time-to-live - Round-trip time
Common Usage Patterns
Quick test:
ping -c 1 host
Extended monitoring:
ping -i 60 host
Network quality:
ping -f host
Performance Analysis
- Response time
- Packet loss
- Jitter
- Route stability
- Network latency
Additional Resources
Best Practices
- Use count limits
- Appropriate intervals
- Size considerations
- Regular testing
- Documentation
Troubleshooting
- No response
- High latency
- Packet loss
- Route issues
- DNS problems
Network Metrics
- Round-trip time
- Packet loss rate
- Response variation
- Time-to-live
- Path MTU