Pathping is one of the best network troubleshooting tools that are built-in to Windows. It helps you to find the location of a packet loss in a route between you and a host (server, router, website etc). Something I use quite often in my work.
The Pathping command is a combination of Ping and Tracert. Where a ping command only test the network connection between the source (your computer) and the destination, Pathping will test the connection to each hop between it. When you run a Pathping, it will first trace the route to the destination and then performs a ping to each node in between it.
How to use the Pathping cmd
Pathping is only available on Windows, if you are using Linux you should take a look at mtr. Pathping can be run from the command prompt or in PowerShell. To open command prompt you can do the following:
- Press Windows key + R to open the Run Window
- Type cmd
- Press enter
Now to use the command you only have to enter pathping followed by the IP Address or hostname, just like with a normal ping.
1. pathping 172.16.0.254
Depending on the number of hops between you and the destination it can take a couple of minutes before the results are calculated. First, the command will trace the router, showing your every node on the route. This alone is already really useful information, you can immediately see where the problem occurs (for example in a firewall).
C:\Users\rmens>pathping 172.16.0.254 Tracing route to 172.16.0.254 over a maximum of 30 hops 0 lab-book01.lazyadmin.local [192.168.1.19] 1 192.168.1.1 2 172.16.0.254 Computing statistics for 50 seconds... Source to Here This Node/Link Hop RTT Lost/Sent = Pct Lost/Sent = Pct Address 0 lab-book01.lazyadmin.local [192.168.1.19] 0/ 100 = 0% | 1 1ms 0/ 100 = 0% 0/ 100 = 0% 192.168.1.1 0/ 100 = 0% | 2 1ms 0/ 100 = 0% 0/ 100 = 0% 172.16.0.254 Trace complete.
After the trace is completed it will then calculate the latency and packet loss for each hop on the route. Now, this is the part the takes some time. If you don’t need the latency info, you can simply cancel it with ctrl + c.
Pathping uses the ICMP protocol. Now you will notice when you try a pathping to google.com for example, that it will abort after your ISP. This comes due to the fact that some server, routers or firewalls have blocked the ICMP protocol. So you can resolve it.
Speeding up the PathPing command
As I said earlier, pathping is a bit slow. But you can speed it up by adding some switches to it. By default, pathping will resolve each hostname of every hop it comes across. It will also send 100 queries by default to each host.
So what we can do is disable the hostname resolve and lower the number of queries that pathping does on each hop with the following command:
1. pathping -q 10 -n -p 100 lazyadmin.nl
1. Pathping -q 10
With -q switch we set the amount of queries to 10 instead of the default 100. This will speedup the statics that are computed after the trace.
1. Pathping -n
The -n switch prevents the command from resolving the hostnames. This speeds up the trace route part of the command.
1. Pathping -p 100
The -p switch lowers the wait time between each ping. By default pathping will wait 250ms, so if you set it 100ms it will 10 pings in a second instead of 4.
1. Pathping -h 4
Another useful option is the -h switch. With -h you can specify the number of hops you want to test. Let’s say you only want to test if you can reach your ISP, then limiting the number of hops to 4 or 5 will be sufficient.
1. Pathping -w 500
The last useful switch is -w. When a host is unreachable it takes up to 3 seconds before it tries again. By setting the wait time to 500ms you can speed up the results.
The more complex your network is, the more often you will use this tool. It gives some great insights on your network routes and makes debugging network issue a lot easier. I have never used tracert again since I learned about this command and its abilities.
You may also like this article about the ping command, you might pick up a few new things from it as well.