Troubleshooting networks can present a number of challenges, particularly when you do not have administrative access to all the components between two systems, including firewalls and routers. It becomes even more complex when dealing with Internet circuits, since once your traffic leaves your network, you have even less visibility into what is happening on the wire. Tools like Netmon and Wireshark are great for taking packet captures, but these can be complicated to setup, can only capture traffic so you still have to generate traffic to test, and often grab far more than you really need, so you spend time wading through all the noise. If you want a fast, easy to use, command line tool for troubleshooting network connectivity, take a look at PSPing.
PSPing is one of the many great free tools from Microsoft by way of their purchase of Sysinternals. Created by Mark Russinovich, PSPing can test for bandwidth and latency over both TCP and UDP connections, using a syntax and output very similar to PING. You can use PSPing to perform simple “is it up” tests for services, or when ICMP is blocked by a firewall, but you can also perform much more complex network troubleshooting for problems caused by latency, or related to bandwidth. Let’s start by downloading and installing the tool.
Download and Install
You can download PSPing as a part of the Sysinternals toolset by visiting http://technet.microsoft.com/en-us/sysinternals/jj729731.aspx. PSPing is a self-contained executable, so simply copy it to a directory that is already in your path (or add your chosen directory to your path) so that you can run it without having to specify the filesystem location. You can also run it “live” from http://live.sysinternals.com/psping.exe if you prefer.
Now let’s take a look at the simple syntax.
As you can see, psping with no arguments returns a simple help output, and shows you how to get more specific help for ICMP, TCP, latency, and bandwidth. We will let you run each additional -? to see the syntax for ICMP, TCP, latency, and bandwidth. What we want to do is provide some examples to get you started.
PSPing’s ICMP testing is very similar to Window’s ping cmd. The default will send five pings, display time for each (but not TTL) and the same stats, but to a greater degree of precision. Ping measures to the millisecond (10^-3,) while PSPing measures to the hundredths of a millisecond (10^-5.)
PSPing also offers histograms, control of interval and payload, iterations and non-stop with the same CTRL-BREAK and CTRL-C functionality, and the ability to use IPv4 or IPv6. Here’s an example that will use all of the options to test.
That says to perform an ICMP ping (default, nothing specified) and provide a histogram with 10 buckets, ping as fast as possible, use 1500 byte payloads, send 10 pings (plus the default 1 for warmup) and use IPv4. And oh, yeah, and the target is google.com.
If all you need to do is confirm that the target is “up” then ICMP is great, but if you need to check a service, or if some overzealous firewall admin says “to heck with RFCs!” and decides to block pings, using TCP to a specific port is a great way to go. To run the same test against TCP port 80, simply append :80 to the target.
Latency tests can be performed as long as you control both the client and the server, as you have to start up a listening service on one side and connect to it from the other. To test latency, start up an administrative cmd prompt on the server.
That command starts up a listener using the specified ip.addr on TCP port 99. The –f says to open the Windows firewall up for this (if necessary.) That’s part of the reason to use an admin cmd prompt.
Then, on the client, try this.
Which says to use IPv4, create a histogram of 10 buckets, use 1000 bytes of payload, and target the server at TCP port 99 on 192.168.0.129.
If you wanted to use UDP instead, use the –u switch on both client and server.
The Bandwidth test can help you determine just how much data you can pass between A and B. This is much easier to get going than using iPerf. If you didn’t kill the server listener from the previous test, you can keep using it. Here’s how to run a bandwidth test from the client.
That syntax specifies to perform a bandwidth test (-b,) over IPv4, and use 5000 packets of 8000 bytes each, targeting the same server and TCP port as the last test.
PSPing: one tool with lots of tests. Try it out the next time you want to troubleshoot your network and see how much use you can get out of this great, free, and tiny little tool!