Testing connectivity with PsPing

Psping is a useful tool to test connectivity between endpoints when ping(ICMP) is not allowed.

You can come across such scenarios because many organizations disable ICMP protocol for security reasons. Having worked as Azure cloud support there were many instances in which ping was not working even with proper Network security groups configured for inbound and outbound ICMP.

In such cases you can use psping on Windows or tcpdump, which can act as normal ping or if you define ports can use TCP which is generally allowed in networks. You can also use psping to test latency/bandwidth.

Download link:  https://docs.microsoft.com/en-us/sysinternals/downloads

PSPing is a self-contained executable file. You can download the zip file and copy it to a directory that is already in your path or add another path.

For example I tend to move the zip to a Desktop folder that I name pstools and using the cmd I naviage to that folder using cd, dir. There will be a separate article about working with the command prompt in Windows.

In the first example we will use psping(TCP ping) to check connectivity to one of Google’s DNS servers on port 80. Type psping 8.8.4.4:80 and see if Google listens on that port:

: 8.8.4.4:8ø sping v2.1e - PsPing - ping, latency, bandwidth measurement utility pyright (c) 2e12-2e16 mark Russinovich ysinternals - sysinternals.cm cp connect to 8.8.4.4:8ø: 5 iterations (warmup 1) ping test: nnecting to 8.8.4.4:8ø (wamwp): Sent e, Received ø, Lost ø (OX loss), minimum = Maxinwm = e.&ns, Average = ø.&ns ntrol -C

As we see Google doesn’t respond on port 80, but it always responds on port 443 as shown below:

C: 8.8.4.4:443 PsPing v2.1ø - PsPing - ping, latency, bandwidth measurement utility Copyright (C) 2ø12-2e16 Mark Russinovich Sysinternals - connect to 8.8.4.4:443: 5 iterations (warrnup 1) ping test: Connecting to 8.8.4.4:443 (warmup) : fro-n 192.168.1.15:55859: Connecting to 8.8.4.4:443: fran 192. Connecting to 8.8.4.4:443: frun 192. Connecting to 8.8.4.4:443: fmxn 192. Connecting to 8.8.4.4:443: frun 192 2.96ms 168.1.15:55862: 168.1.15:55864: 168.1.15:55865: .168.1.15:55869: connect statistics for 8.8.4.4:443: Sent 4, Received 4, Lost (OX loss), 2.74ms 2.57ms 2.70ns 3 .eans

Next, we will explore how psping can be used as normal ping. In its default you can simply type ping 8.8.8.8 or ping facebook.com

facebook.cm PsPing v2.1ø - PsPing - ping, latency, bandwidth measurement utility Copyright (C) 2012-2016 Mark Russinovich Sysinternals - sysinternals .cm Pinging 157.24e.9.35 with 32 bytes of data: 5 iterations (warmup 1) ping test: Reply 157.24e.9. 35: 3.36ms Reply 157.24e 9. . 35: 2.30ns Reply 157.24e 9. . 35: 2.24ms Reply 157.24e.9. 35: 2.37ms Reply fran 157.24e 9. . 35: 2.25ms Ping statistics for 157.240.9.35: Sent 4, Received 4, Lost e loss), 2.24ms, maximum = 2.37ms, Average = 2.29ms

Now we can explore some of the parameters of psping.

Refer to the below table for psping parameters:

Parameter

Description

-h

Prints histogram with default bucket count 20

If you specify a single argument, it’s interpreted as a bucket count and the histogram will contain that number of buckets covering the entire time range of values. Specify a comma-separated list of times to create a custom histogram for example 0.01,0.02,1,10

-i

Interval in seconds. Specify 0 for fast ping

-l

Request packet size. If you type k is for kilobytes and m for megabytes

-n

Number of pings or you can put ‘s’ to specify seconds e.g. ’10s’

-4

Force using IPv4

-q

No output during pings

Here are some examples of parameter usage below:

-n 2ø -i -q facebook.can PsPing v2.1ø - PsPing - ping, latency, bandwidth measurement utility opyright (C) 2012-2016 Mark Russinovich ysinternals - W". sysinternals Pinging 157.20.9.35 With 32 bytes Of data: iterations (warmup I) ping test: Ping statistics for 157.240.9.35: Sent 2ø, Received = 2ø, Lost loss), Minimum 2.38ms, maximum Average = 3.98ms : Users

Latency testing

It is used to measure the time for data to reach the destination over the network. It is measured by the time it take t reach the destination and to go back to the source. This is called round-trip.

In order to test for round-trip delay you must have to accessible machines or virtual machines.

On one of the machine will only listen on specific port and the other will send packets.

To start PsPing listener on the machine:

psping -4 -s 192.168.1.2:3389

Port 3389 is used for RDP(Remote Desktop Protocol) and you must ensure that Windows firewall inbound and outbound rules allow this port as well as your networking devices such as physical/virtual firewall.

psping -4 -h 10 -n 10 -l 1000 192.168.1.2:3389

Bandwidth testing

It measures how much data can be transferred between endpoints for a specific time. It is normally measured in megabytes per second.

You should have a machine listening on a TCP port and the other machine will run the psping, which will send a packet with specific size. The result will be a bandwidth statistic:

psping -b -4 -n 2000 -l 3000 127.0.0.1:49926

-b -4 -n 2øøø -1 3øee 127.ø.ø.1:49926 PsPing v2.1ø - PsPing - ping, latency, bandwidth measurement utility opyright (C) 2ø12-&16 Mark Russinovich Sysinternals - wu.sysinternals. cm Setting warmup count to match nunber of outstanding I/Os: 16 CP bandwidth test connecting to 127.ø.e.1:49926: Connected 2016 iterations (16 warmup) sending 3øee bytes TCP bandwidth test he specified neonrk name is no longer available. sender bandwidth statistics: sent = 1419, Size = 3eøe, Total Bytes: 4257øøØ, Minimum = 7.85 t.B/s, Maxinwrn = 18.ø4 MB's, Average = 7.85 MB's : -152175

If you remember -4 sets IPv4, 2000 packets of 3000 bytes in size. In this example I used the localhost as I don’t have another VM set up, so you can do it too for quick tests.

In conclusion psping is a very handy tool, easy to use and helpful for testing connectivity, especially in the cloud environment where many different services are running.

Leave a Reply

Your email address will not be published. Required fields are marked *