Difference between revisions of "Ping (command)"
Jump to navigation
Jump to search
↑ https://linux.die.net/man/8/ping
↑ https://www.paessler.com/manuals/prtg/ping_sensor
(→nmap) |
|||
(55 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{lowercase}} | ||
<code>[[wikipedia:Ping_(networking_utility)|ping]]</code> ([[1983]]) command is available in almost all operating systems. The command-line options of the ping utility and its output vary between the numerous implementations. Options may include among others: | <code>[[wikipedia:Ping_(networking_utility)|ping]]</code> ([[1983]]) command is available in almost all operating systems. The command-line options of the ping utility and its output vary between the numerous implementations. Options may include among others: | ||
* Count of tests: (<code>-c</code>)<ref>https://linux.die.net/man/8/ping</ref> (Linux and macOS), (<code>-n</code> Windows) | * Count of tests: (<code>-c</code>)<ref>https://linux.die.net/man/8/ping</ref> (Linux and macOS), (<code>-n</code> Windows) | ||
Line 4: | Line 5: | ||
* Limits for the number of network hops (<code>[[TTL]]</code>) that probes traverse | * Limits for the number of network hops (<code>[[TTL]]</code>) that probes traverse | ||
Timing options: | Timing options: | ||
− | * Timeout for exiting: <code>-t</code> (macOS), Linux not implemented. | + | * Timeout for exiting: <code>[[-t]]</code> (macOS), Linux not implemented. |
− | * Interval between the requests | + | * [[Interval]] between the requests <code>-i</code> (macOS) |
* Time to wait for a response (<code>-W</code>) miliseconds for macOS and seconds for Linux | * Time to wait for a response (<code>-W</code>) miliseconds for macOS and seconds for Linux | ||
Output format: | Output format: | ||
− | * Include timestamp on each line: Linux (<code>-D</code>) | + | * Include [[timestamp]] on each line: Linux (<code>-D</code>) |
== Linux == | == Linux == | ||
[[man]] page: https://linux.die.net/man/8/ping | [[man]] page: https://linux.die.net/man/8/ping | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | --- www.example.com ping statistics --- | + | $ [[ping -c]] 5 www.example.com |
− | 5 packets transmitted, 5 packets received, 0.0% packet loss | + | PING www.example.com (93.184.216.34): 56 data bytes |
− | round-trip min/avg/max/stddev = 9.674/10.968/11.726/0.748 ms | + | 64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.632 ms |
− | + | 64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.726 ms | |
+ | 64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.683 ms | ||
+ | 64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=9.674 ms | ||
+ | 64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=11.127 ms | ||
+ | |||
+ | --- www.example.com ping statistics --- | ||
+ | 5 packets transmitted, 5 packets received, 0.0% packet loss | ||
+ | round-trip min/avg/max/[[stddev]] = 9.674/10.968/11.726/0.748 ms | ||
ping -i google.com | ping -i google.com | ||
− | ping -a IP | + | [[Audible]] ping |
+ | [[ping -a]] IP | ||
ping hostwithoutdomain | ping hostwithoutdomain | ||
Line 49: | Line 50: | ||
ping -c1 -t1 www.example.com | ping -c1 -t1 www.example.com | ||
-t timeout (not available in Linux) | -t timeout (not available in Linux) | ||
+ | |||
+ | [[ping -i]] 0.1 google.com | ||
+ | |||
+ | Note: [[macOS application firewall]] in stealth mode ignores ICMP requests. | ||
== [[Ping (PAN-OS)|PAN-OS]] == | == [[Ping (PAN-OS)|PAN-OS]] == | ||
− | + | * <code>[[ping host]] 10.10.10.xxx</code> | |
== nmap == | == nmap == | ||
− | + | * <code>[[nmap]] -sn 10.10.10.*</code> | |
== [[Cisco IOS]] == | == [[Cisco IOS]] == | ||
+ | |||
+ | ping 10.10.10.1 | ||
+ | Type escape sequence to abort. | ||
+ | Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: | ||
+ | ..... | ||
+ | Success rate is 0 percent (0/5) | ||
+ | |||
+ | See also: <code>[[ios_ping]]</code> [[Ansible module]] | ||
== Activities == | == Activities == | ||
Line 66: | Line 79: | ||
* Use <code>[[nmap]]</code> for ping a full subnet: <code>[[nmap]] -sn 192.168.0.*</code> | * Use <code>[[nmap]]</code> for ping a full subnet: <code>[[nmap]] -sn 192.168.0.*</code> | ||
− | * [[Windows]]: <code>netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow</code> | + | * [[Windows]]: |
+ | ** <code>[[netsh advfirewall]] firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow</code> | ||
− | == Related | + | == Other sofware using ping == |
− | * <code>[[mtr]]</code> | + | * <code>[[jfrog rt ping]]</code> |
+ | * <code>[[rabbitmqctl ping]]</code> | ||
+ | * <code>[[redis-cli ping]]</code> | ||
+ | * <code>[[ipfs ping]]</code> | ||
+ | * <code>[[influx ping]]</code> | ||
+ | * <code>[[nats server ping]]</code> | ||
+ | * <code>[[netdatacli ping]]</code> | ||
+ | * <code>[[tailscale ping]]</code> | ||
+ | |||
+ | == Related == | ||
+ | * <code>[[mtr]]</code>, <code>[[traceroute]]</code> | ||
* [[ping (Cisco IOS)]] | * [[ping (Cisco IOS)]] | ||
* [[Collectd]] ping plugin | * [[Collectd]] ping plugin | ||
* [[Smokeping]] | * [[Smokeping]] | ||
+ | * [[Jitter]] | ||
+ | * <code>[[tc qdisc]] add dev eth0 root netem delay 5000ms</code> | ||
* <code>[[kill]] -[[SIGINT]] PID</code> | * <code>[[kill]] -[[SIGINT]] PID</code> | ||
+ | * [[PRTG]] ping sensor <ref>https://www.paessler.com/manuals/prtg/ping_sensor</ref> | ||
+ | * <code>[[ping -D]] [[timestamp]]</code> | ||
+ | * <code>[[ansible]] YourWebserversGroup [[-m ping]]</code> | ||
+ | * Using bash tcp built-ins to test connectivity: | ||
+ | echo >/dev/tcp/google.com/80; if [ $? -eq 0 ]; then echo "Connection Successful"; fi | ||
+ | * <code>[[check_ping]]</code> Nagios | ||
+ | |||
+ | >/dev/tcp/google.com/80 && echo Success || echo Failure | ||
+ | * [[Ping An Insurance]] | ||
+ | * [[OpenSSH 9.5]] | ||
+ | * ping [[8.8.8.8]] | ||
+ | * ping [[1.1.1.1]] | ||
== See also == | == See also == | ||
− | * | + | * {{ping cmd}} |
* {{ping}} | * {{ping}} | ||
− | * {{ | + | * {{ICMP}} |
− | + | * {{Network monitoring}} | |
− | * {{ | ||
Latest revision as of 16:57, 10 November 2024
ping
(1983) command is available in almost all operating systems. The command-line options of the ping utility and its output vary between the numerous implementations. Options may include among others:
- Count of tests: (
-c
)[1] (Linux and macOS), (-n
Windows) - Size of the payload
- Limits for the number of network hops (
TTL
) that probes traverse
Timing options:
- Timeout for exiting:
-t
(macOS), Linux not implemented. - Interval between the requests
-i
(macOS) - Time to wait for a response (
-W
) miliseconds for macOS and seconds for Linux
Output format:
- Include timestamp on each line: Linux (
-D
)
Contents
Linux[edit]
man page: https://linux.die.net/man/8/ping
$ ping -c 5 www.example.com PING www.example.com (93.184.216.34): 56 data bytes 64 bytes from 93.184.216.34: icmp_seq=0 ttl=56 time=11.632 ms 64 bytes from 93.184.216.34: icmp_seq=1 ttl=56 time=11.726 ms 64 bytes from 93.184.216.34: icmp_seq=2 ttl=56 time=10.683 ms 64 bytes from 93.184.216.34: icmp_seq=3 ttl=56 time=9.674 ms 64 bytes from 93.184.216.34: icmp_seq=4 ttl=56 time=11.127 ms --- www.example.com ping statistics --- 5 packets transmitted, 5 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 9.674/10.968/11.726/0.748 ms
ping -i google.com
Audible ping
ping -a IP
ping hostwithoutdomain ping: hostwithoutdomain: Name or service not known
ping www.google.com ping: bad address
ping 10.10.xx.xx PING 10.10.xx.xx (10.10.xx.xx) 56(84) bytes of data. From xx.56.242.XX icmp_seq=1 Packet filtered ^C --- 10.10.25.10 ping statistics --- 3 packets transmitted, 0 received, +1 errors, 100% packet loss, time 2012ms
macOS[edit]
ping -c1 -t1 www.example.com -t timeout (not available in Linux)
ping -i 0.1 google.com
Note: macOS application firewall in stealth mode ignores ICMP requests.
PAN-OS[edit]
ping host 10.10.10.xxx
nmap[edit]
nmap -sn 10.10.10.*
Cisco IOS[edit]
ping 10.10.10.1 Type escape sequence to abort. Sending 5, 100-byte ICMP Echos to 10.10.10.1, timeout is 2 seconds: ..... Success rate is 0 percent (0/5)
See also: ios_ping
Ansible module
Activities[edit]
Advanced[edit]
- Review source code of different ping implementation:
- Windows:
netsh advfirewall firewall add rule name="ICMP Allow incoming V4 echo request" protocol=icmpv4:8,any dir=in action=allow
Other sofware using ping[edit]
jfrog rt ping
rabbitmqctl ping
redis-cli ping
ipfs ping
influx ping
nats server ping
netdatacli ping
tailscale ping
Related[edit]
mtr
,traceroute
- ping (Cisco IOS)
- Collectd ping plugin
- Smokeping
- Jitter
tc qdisc add dev eth0 root netem delay 5000ms
kill -SIGINT PID
- PRTG ping sensor [2]
ping -D timestamp
ansible YourWebserversGroup -m ping
- Using bash tcp built-ins to test connectivity:
echo >/dev/tcp/google.com/80; if [ $? -eq 0 ]; then echo "Connection Successful"; fi
check_ping
Nagios
>/dev/tcp/google.com/80 && echo Success || echo Failure
- Ping An Insurance
- OpenSSH 9.5
- ping 8.8.8.8
- ping 1.1.1.1
See also[edit]
ping, ping -a, ping -M, ping -t, ping -c, --help
ping
,nping
,arping
,fping, gping
,hping
,mtr
,traceroute
,tcptraceroute
,tracepath
,Test-Connection
Powershell cmdlet,iperf
, Ping (PAN-OS), BWPing,check_ping
,ping -M
,ios ping, ping -a
- ICMP, 3-Tuple,
ping
- Network monitoring: Cacti, PRTG, MRTG,
ntop
,ntopng
,ping
,nethogs
,netperf
Advertising: