How to install and use IP2Trace on Windows for traceroute

Traceroute is a network diagnostic tool that allows you to trace the path of a network packet from your computer to a remote host over the internet. It can be used to troubleshoot network connectivity issues, identify network latency or congestion, and help to optimize network performance.

Windows comes with a default traceroute tool called “tracert” that allows you to trace network packets to a destination node. To run the tracert tool, open the command prompt window by typing “cmd” in the Windows search bar. Then enter the command shown below:

tracert <destination>

The tracert command shows the Round-Trip Time (RTT) for each hop and its associated IP address. Here’s an example:

However, if you want detailed information about the country name, region name, city name, ISP, domain name, etc., for each hop, you need to use a third-party tool that can provide this information. In this article, I will provide a step-by-step guide on how to use ip2trace, an alternative tool that not only provides traceroute hop results but also more granular information about each hop. This tool is written in Python and requires Python to be installed on your machine.

Before we start, please make sure that you have obtained the IP2Location BIN database, as the database will be used to provide the geolocation information about each hop. You can purchase one at https://www.ip2location.com/database/ip2location, or get a free database from https://lite.ip2location.com/ip2location-lite after signing up. Besides that, the ip2trace will also require the IP2Location Python library to be installed. The pip will install the dependencies for you, but if it doesn’t, you can always manually install it by using pip install IP2Location.

To install the IP2Trace, use the following command in your command prompt: pip install IP2Trace. You will see a success message if the installation is successful:

IP2Trace should have been installed by now. To test whether it is working correctly or not, run the following command to print the IP2Trace version information: ip2tracepy -v. You will the version information is printed out as below:

After installing the ip2trace, you can now use the tool to trace the IP address with geolocation information. A basic usage of ip2trace will look like this: ip2tracepy -p <destination_ip> -d <IP2Location_BIN_database_filepath> -a. You should substitute the <destination_ip> with the IP address that you want to traceroute on, and replace the <IP2Location_BIN_database_filepath> with the filepath of the downloaded IP2Location BIN database. You will see the output generated like this:

You can also choose to customize the output fields of the geolocation information according to your needs. For example, if you want to see only country name, region name and city name, you can run this command: ip2tracepy <destination_ip> -d <IP2Location_BIN_database_filepath> -o country_name, region_name, city_name. The -o here will set the fields to be output with. The available columns are: country_code, country_name, region_name, city_name, isp, latitude, longitude, domain, zip_code, time_zone, net_speed, idd_code, area_code, weather_station_code, weather_station_name, mcc, mnc, mobile_brand, elevation, usage_type, address_type, category, district, asn, as_name. After running the command, you will see the output like this:

In addition, you can also traceroute a hostname directly without the need of translating it to the corresponding IP address beforehand. For example, to traceroute the bing.com, you can use this command to do so:  ip2tracepy -p bing.com -d <IP2Location_BIN_database_filepath> -o country_name, region_name, city_name. Here we replace the destination IP address with the destination hostname. The output for this example is shown below:

In conclusion, traceroute is a powerful network diagnostic tool that can help you troubleshoot network connectivity issues, identify network latency or congestion, and optimize network performance. By using ip2trace, you can easily run traceroute in Windows and analyze the results to gain insights into your network.

Was this article helpful?

Related Articles