
Ping is the best utility to major the Packet Loss, Latency in the network. There are many options
available in ping but I will tell you a few important options which are most needed.
Options | Meanings |
-t | Ping the specified host until interrupted. To see statistics and continue – type Control-Break. To stop – type Control-C. |
-a | Resolve addresses to hostnames. |
-n | Set the number of echo requests to send. Default is 4. |
-l | Set the length (in bytes) of the data field (send buffer size). The default is 32 bytes. Maximum is 65,527. |
-f | Set the Don’t Fragment flag in packet (IPv4-only) in the IP header set to 1. The echo Request message cannot be fragmented by routers in the path to the destination. This parameter is useful for troubleshooting path Maximum Transmission Unit (PMTU) problems. |
-i | Set the Time To Live value. The default is the default TTL value of the host. The maximum TTL is 255. |
-v | Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header). |
-r | Record route for count hops (IPv4-only).Count must be a minimum of 1 and a maximum of 9. |
-s | Timestamp for count hops (IPv4-only). Count must be a minimum of 1 and a maximum of 4. |
-j | Loose source route along host-list (IPv4-only). With loose source routing, successive intermediate destinations can be separated by one or more routers. The maximum number of addresses of names is the host list is nine (9). The hostlist is simply a series of IP addresses in dotted-decimal notation (e.g., 192.168.128.8) each separated by spaces. This parameter is only for IPv4 addresses. |
-k | Strict source route along host-list (IPv4-only). With strict source routing, successive intermediate destinations must be directly reachable. The maximum number of addresses of names in the host list is nine (9). The hostlist is simply a series of IP addresses in dotted-decimal notation (e.g., 192.168.128.8) each separated by spaces. This parameter is only for IPv4 addresses. |
-w | Timeout in milliseconds to wait for each reply. |
-R | Use routing header to test reverse route also (IPv6-only). Per RFC 5095 the use of this routing header has been deprecated. Some systems may drop echo requests if this header is used. |
-S | Source address to use (IPv6-only). |
-c | Routing compartment identifier. |
-p | Ping a Hyper-V Network Virtualization provider address. |
-4 | Force tracert to use IPv4 for the trace. |
-6 | Force tracert to use IPv6 for the trace. |
/? | Displays help information. |
1-Normal Ping
Open your cmd and run the ping command as given below .
C:\WINDOWS\system32>ping google.com Pinging google.com [142.250.192.110] with 32 bytes of data: Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=85ms TTL=117 Reply from 142.250.192.110: bytes=32 time=81ms TTL=117 Ping statistics for 142.250.192.110: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 78ms, Maximum = 85ms, Average = 80ms C:\WINDOWS\system32> C:\WINDOWS\system32>ping 142.250.192.110 Pinging 142.250.192.110 with 32 bytes of data: Reply from 142.250.192.110: bytes=32 time=80ms TTL=117 Reply from 142.250.192.110: bytes=32 time=80ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=81ms TTL=117 Ping statistics for 142.250.192.110: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 78ms, Maximum = 81ms, Average = 79ms C:\WINDOWS\system32>
2-Continuous Ping .
To run a continuous ping , You have to use the option called -t
C:\WINDOWS\system32>ping google.com -t Pinging google.com [142.250.192.110] with 32 bytes of data: Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=84ms TTL=117 Reply from 142.250.192.110: bytes=32 time=83ms TTL=117 Reply from 142.250.192.110: bytes=32 time=85ms TTL=117 Reply from 142.250.192.110: bytes=32 time=84ms TTL=117 Reply from 142.250.192.110: bytes=32 time=82ms TTL=117 Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=83ms TTL=117 Reply from 142.250.192.110: bytes=32 time=82ms TTL=117 Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=84ms TTL=117 Reply from 142.250.192.110: bytes=32 time=90ms TTL=117 Reply from 142.250.192.110: bytes=32 time=82ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=80ms TTL=117 Reply from 142.250.192.110: bytes=32 time=81ms TTL=117 Reply from 142.250.192.110: bytes=32 time=80ms TTL=117 Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Reply from 142.250.192.110: bytes=32 time=78ms TTL=117 Reply from 142.250.192.110: bytes=32 time=79ms TTL=117 Ping statistics for 142.250.192.110: Packets: Sent = 23, Received = 23, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 78ms, Maximum = 90ms, Average = 81ms Control-C ^C C:\WINDOWS\system32>
3-Ping using -n option.
-n option used for the number of ping packets we want to send. By default in windows, it sends 4 ping packets only .Lets say we want to 10 ping packets.
C:\WINDOWS\system32>ping -n 10 google.com Pinging google.com [216.58.203.46] with 32 bytes of data: Reply from 216.58.203.46: bytes=32 time=72ms TTL=117 Reply from 216.58.203.46: bytes=32 time=77ms TTL=117 Reply from 216.58.203.46: bytes=32 time=71ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=86ms TTL=117 Reply from 216.58.203.46: bytes=32 time=72ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=72ms TTL=117 Ping statistics for 216.58.203.46: Packets: Sent = 10, Received = 10, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 68ms, Maximum = 86ms, Average = 72ms C:\WINDOWS\system32>
4-Ping with customer Packet size using -l option.
As we know ping command uses the services of the Internet Control Message Protocol (ICMP), the latter being encapsulated in the IP header. Therefore, the ping utility operates basically on layer 3 (the Network layer) of the OSI model. By default in windows, the ping packet size is 32Byte.But if you want you can set the packet size on your own, the packet size can be up to 65535.
C:\WINDOWS\system32>ping -l 1472 google.com Pinging google.com [142.250.67.206] with 1472 bytes of data: Reply from 142.250.67.206: bytes=68 (sent 1472) time=69ms TTL=117 Reply from 142.250.67.206: bytes=68 (sent 1472) time=69ms TTL=117 Reply from 142.250.67.206: bytes=68 (sent 1472) time=71ms TTL=117 Reply from 142.250.67.206: bytes=68 (sent 1472) time=68ms TTL=117 Ping statistics for 142.250.67.206: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 68ms, Maximum = 71ms, Average = 69ms C:\WINDOWS\system32>
5-Ping to Find Hostname of an IP Address.
C:\WINDOWS\system32>ping -a 216.58.203.46 Pinging hkg12s10-in-f46.1e100.net [216.58.203.46] with 32 bytes of data: Reply from 216.58.203.46: bytes=32 time=70ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=68ms TTL=117 Reply from 216.58.203.46: bytes=32 time=71ms TTL=117 Ping statistics for 216.58.203.46: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 68ms, Maximum = 71ms, Average = 69ms C:\WINDOWS\system32>
6-PING to an IP Address to find the Domain Name of that IP.
C:\WINDOWS\system32>ping google.com Pinging google.com [142.250.206.110] with 32 bytes of data: Reply from 142.250.206.110: bytes=32 time=47ms TTL=118 Reply from 142.250.206.110: bytes=32 time=48ms TTL=118 Reply from 142.250.206.110: bytes=32 time=45ms TTL=118 Reply from 142.250.206.110: bytes=32 time=46ms TTL=118 Ping statistics for 142.250.206.110: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 45ms, Maximum = 48ms, Average = 46ms C:\WINDOWS\system32>
7-How to take Help from CMD.
C:\WINDOWS\system32>ping /? Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [[-j host-list] | [-k host-list]] [-w timeout] [-R] [-S srcaddr] [-c compartment] [-p] [-4] [-6] target_name Options: -t Ping the specified host until stopped. To see statistics and continue - type Control-Break; To stop - type Control-C. -a Resolve addresses to hostnames. -n count Number of echo requests to send. -l size Send buffer size. -f Set Don't Fragment flag in packet (IPv4-only). -i TTL Time To Live. -v TOS Type Of Service (IPv4-only. This setting has been deprecated and has no effect on the type of service field in the IP Header). -r count Record route for count hops (IPv4-only). -s count Timestamp for count hops (IPv4-only). -j host-list Loose source route along host-list (IPv4-only). -k host-list Strict source route along host-list (IPv4-only). -w timeout Timeout in milliseconds to wait for each reply. -R Use routing header to test reverse route also (IPv6-only). Per RFC 5095 the use of this routing header has been deprecated. Some systems may drop echo requests if this header is used. -S srcaddr Source address to use. -c compartment Routing compartment identifier. -p Ping a Hyper-V Network Virtualization provider address. -4 Force using IPv4. -6 Force using IPv6. C:\WINDOWS\system32>
8-Ping with Don’t Fragment bit.
You can use -f option in PING if you want that the packet no need to be fragmented .in My network only 1452 Byte payload is supported .
C:\WINDOWS\system32>ping -l 1453 -f google.com Pinging google.com [142.250.193.46] with 1453 bytes of data: Reply from 192.168.1.1: Packet needs to be fragmented but DF set. Packet needs to be fragmented but DF set. Packet needs to be fragmented but DF set. Ping statistics for 142.250.193.46: Packets: Sent = 3, Received = 1, Lost = 2 (66% loss), Control-C ^C C:\WINDOWS\system32>ping -l 1452 -f google.com Pinging google.com [142.250.193.46] with 1452 bytes of data: Reply from 142.250.193.46: bytes=68 (sent 1452) time=47ms TTL=118 Reply from 142.250.193.46: bytes=68 (sent 1452) time=48ms TTL=118 Reply from 142.250.193.46: bytes=68 (sent 1452) time=51ms TTL=118 Reply from 142.250.193.46: bytes=68 (sent 1452) time=46ms TTL=118 Ping statistics for 142.250.193.46: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 46ms, Maximum = 51ms, Average = 48ms C:\WINDOWS\system32>