The pathping command is one of the most popular network troubleshooting tools in Windows. Initially released in 2000 along with Windows 2000, it has since been a part of every version. Despite its simplicity, it has become prevalent among network admins and is one of the first tools they turn to when things are not going right.
This command combines the functionality of tracert and ping.
In this article, we’ll be exploring what a pathping command is, what it does, and how to use it. Plus, we have answers for some of the most frequently asked questions!
Read on to learn more about this simple command-line tool that IT teams have come to rely upon.
What is the pathping command?
The pathping command is a command-line utility tool in Windows operating systems. It is commonly used to troubleshoot network issues, particularly the ones related to latency and network performance.
It is considered an alternative to tracert and it combines ping and tracert commands. This means that, like tracert, pathping traces all the intermediate hops between a source and a destination, and like ping, it gives you latency and packet loss data. However, pathping will show more detailed results as it can detect which routers are having problems and where they are located.
This is how the results for a pathping command look like:
When you enter the command, it lists all the source and destination routers. It computes statistics for a given time and gathers information about all routers. In the above case, this was for 200 seconds. Then the data is displayed.
As with ping and tracert, the pathping command also uses the ICMP protocol.
It's important to notice that the command is not available on the Linux system; instead, you can use mtr command here.
The pathping syntaxis
The pathping syntax is pretty straightforward. To perform a simple pathping, open a command prompt and type
pathping followed by the URL or IP address.
The basic syntax for using pathping is:
pathping -n [target]
For example, here’s the command to perform a pathping on facebook.com:
For network troubleshooting, you can customize pathping with various parameters. The pathping command is generally slow, but you can speed up the process with these parameters.
For example, when using ‘/n’, the pathping command doesn’t resolve the IP addresses of the routers involved. Once again, taking the example of facebook.com, the command will then look like:
pathping /n www.facebook.com
You can also specify the maximum number of hops before stopping pathping using /h and the number of echo requests sent to each router between with /q. The pathping command will stop after a default of 30 hops, but if you’re facing a network issue, this could mean the packet never reached the destination. You can also speed up the process by reducing the number of echo requests using the /q parameter.
To use the /h parameter, this is how the command will look like:
pathping /h 4 www.facebook.com
In the above example, the number of hops is limited to 4.
To use the /q parameter, the syntax will look like this:
pathping /q 20 www.facebook.com
With pathping, you can also specify the time between consecutive pings (/p), the time to wait for a reply (/w), and many other parameters and even specify that the command using only IPv4 (/4) or IPv6 (/6).
In Linux, the syntax is similar, except you use mtr instead of pathping. For example:
To specify the number of pings in mtr (like /q in pathping), you use -c followed by the number. For example, to ping 30 times every router with mtr, the command will look like this:
mtr -c 30 www.facebook.com
And to adjust the number of hops with mtr, you can use the -m parameter. For example, to set the number of hops as 4, you can use:
mtr -m 3 www.facebook.com
With mtr, you can print the output as CSV (-csv), as XML (-xml), specify the time between echo requests (-i), specify packet size (-s), and specify many other parameters.
How to use the pathping command?
As we already mentioned, the pathping command is excellent for troubleshooting network issues. If a service takes too long to respond, you can use pathping to figure out where the problem is. Maybe the server is slow, or there’s an issue somewhere along the route. It could be there is a problem with your local network, or maybe there’s an issue with your ISP.
Also, the pathping command is used to measure the quality of a host-to-host computer network connection. The command sends Internet Control Message Protocol (ICMP) echo requests to each pointed-to destination. It then displays the response time and packet loss for the packets returned from each destination. If the packet loss is not zero and the round trip time is still under 1000 milliseconds, it is likely that the connection is experiencing significant latency.
Here’s how the pathping command will look if you’re setting the interval between echo requests to 200 milliseconds.
pathping /p 200 www.facebook.com
For setting the timeout period to 200 milliseconds, the command will look like this:
pathping /w 300 www.facebook.com
If you want to minimize the hops to 4 and echo requests to 20, the command will look like:
pathping /h 4 /q 20 www.facebook.com
The pathping command is a standard tool used to troubleshoot network issues. Typically, it first finds the routers between the source and the destination, and then finds latency and packet loss between the source and all the routers along the way by sending echo requests.
The syntax for the pathping command is pretty simple, just
pathping followed by IP address or the URL. You can customize the command with many parameters. Here’s a list with the most common ones:
- /q - to set the number of echo requests
- /h - to set the maximum number of hops
- /w- to set the timeout period waiting for a reply
- /n - to prevent the command from resolving the IP address of the routers
Lastly, don't forget that the pathping command is unavailable in Linux; instead, you have the mtr command. It does precisely the same job as pathping. And, of course, you can also customize the parameters of the mtr command.
Frequently Asked Questions
What’s the difference between ping and pathping commands?
With ping, you get the latency and packet loss between the source and the destination. In pathping, you get a list of all the routers between the source and the destination, as well as the latency and packet loss between all the routers along the way and the source.
What’s the difference between tracert and pathping?
Tracert gets you a list of all the routers between the source and the destination and the time between the individual hops. Pathping brings you all the details that you get with tracert but also includes details like latency and packet loss between all the routers and the source computer.