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:
As we see Google doesn’t respond on port 80, but it always responds on port 443 as shown below:
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
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:
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
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.