


























Just as a heads-up, this is going to be a quick reference guide for the use of the ICMP echo request - or better known as PING. I have to look up some options multiple times a week, so I thought it is beneficial to write it up in a post like this. I might add more options at some point, but those are the most important ones in my experience.
In a nutshell: ICMP echo requests can be used to check the reachability of two hosts on layer 3. This is indispensable in any troubleshooting session if the network is involved.
Side note: All Linux references should work on MacOS too.
ping 10.10.20.1Results
kuser@pleasejustwork:~$ ping 10.10.20.1
PING 10.10.20.1 (10.10.20.1) 56(84) bytes of data.
64 bytes from 10.10.20.1: icmp_seq=1 ttl=255 time=0.594 ms
64 bytes from 10.10.20.1: icmp_seq=2 ttl=255 time=0.489 ms
64 bytes from 10.10.20.1: icmp_seq=3 ttl=255 time=0.501 ms
64 bytes from 10.10.20.1: icmp_seq=4 ttl=255 time=0.504 ms
64 bytes from 10.10.20.1: icmp_seq=5 ttl=255 time=0.534 ms
^C
--- 10.10.20.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4075ms
rtt min/avg/max/mdev = 0.489/0.524/0.594/0.037 ms
ping 10.10.20.1Results
C:\Users\windows-sucks>ping 10.10.20.1
Pinging 10.10.20.1 with 32 bytes of data:
Reply from 10.10.20.1: bytes=32 time<1ms TTL=255
Reply from 10.10.20.1: bytes=32 time<1ms TTL=255
Reply from 10.10.20.1: bytes=32 time<1ms TTL=255
Reply from 10.10.20.1: bytes=32 time<1ms TTL=255
Ping statistics for 10.10.20.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Test-Connection 10.10.20.1Side note: this will take longer. The internet says it takes longer since the output is a Win32_PingStatus object you can work with. You can get a quick True or False with the -Quiet argument.
Side note: Not all options are available for PS 5.1. You can check your current version with $PSVersionTable.PSVersion.
Results
PS C:\Users\windows-sucks> Test-Connection -Computername 10.10.20.1
Source Destination IPV4Address IPV6Address Bytes Time(ms)
------ ----------- ----------- ----------- ----- --------
DESKTOP-GP... 10.10.20.1 32 0
DESKTOP-GP... 10.10.20.1 32 0
DESKTOP-GP... 10.10.20.1 32 0
DESKTOP-GP... 10.10.20.1 32 0
Test-NetConnection 10.10.20.1 / tnc 10.10.20.1Test-NetConnection can be abbreviated with tncTest-NetConnection on only suited for ping requests without any options. I'll write about Test-Connection in the rest of the post since it offers more options.
Results
PS C:\Users\windows-sucks> Test-NetConnection 10.10.20.1 ComputerName : 10.10.20.1
RemoteAddress : 10.10.20.1
InterfaceAlias : Ethernet
SourceAddress : 10.10.20.54
PingSucceeded : True
PingReplyDetails (RTT) : 0 ms
/t or -tCTRL + c-RepeatSets the number of pings
-c NUMBER/n NUMBER / -n NUMBER-Count NUMBER-I INTERFACE-NAME-S SOURCE-IPYou get results faster if you can avoid domain name resolution.
-n to avoid it-n/a / -a-qping 10.10.20.2 > nul 2>&1-QuietTrue / False-D-s NUMBER/l NUMBER / -l NUMBER-BufferSize NUMBERSets the IP Time to live!
-t NUMBER/i NUMBER / -i NUMBER-MaxHops NUMBERSets the DF flag in the IP header.
-M hint/f / -f-DontFragment-4 # IPv4-6 # IPv6/4 / -4 # IPv4/6 / -6 # IPv6-IPv4 # IPv4-IPv6 # IPv6此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。