Windows

Troubleshoot Windows TCP/IP problems with our Route Utility

Use this GUI for Windows Route tool to make solving network problems easier.

When you're troubleshooting TCP/IP connectivity problems on a Windows network, you may need to investigate the current IP routing table and add or delete specific IP routes. Fortunately, Windows comes with a command line tool called Route that you can use to reveal and edit this type of information. Unfortunately, the Route tool is stuck in the DOS-based world of the command line. As such, it's often overlooked or avoided when it comes time for troubleshooting TCP/IP connectivity problems that may be rooted in the routing table.

To make the Route tool easier to use, I've moved it out of the command line and created an HTML Application (HTA) that uses Windows Script Host and VBScript to give this handy tool a GUI front end that I call the Route Utility. Using this interface to the Route command line tool will save you both time and frustration when working with a routing table on a local system.

The Route Utility's backward compatibility
The Route Utility was designed for Windows XP, but will work in all versions of the Windows operating system. When using it in other Windows operating systems, just remember that the versions of the Route command in these earlier operating systems do not support the full set of parameters implemented by Windows XP's Route command. For example, Windows 98's Route command line tool doesn't provide the -p or the If parameters.

The Route command line tool
The Route command line tool is designed to display and modify the entries in the local routing table. This allows you to view and alter the path that the network traffic on a particular system follows to get from one place to another.

The syntax for the Route command is:
Route [-f] [-p] [Subcommand] [Destination] [Mask Netmask] [Gateway] [Metric Value] [if Interface]

The -f parameter allows you to remove all gateway entries from the local routing table. However, it doesn't remove host routes, the loopback network route, or the multicast route. When the -f parameter is used along with any of the subcommands, the table is cleared before the command is run.

The -p parameter allows you to add persistent routes to the routing table or to display persistent routes in the routing table. For example, if you were to use just the Add subcommand to add a route to the routing table, it would exist as a valid route for the current session only. As soon as you rebooted the system, the TCP/IP protocol would reinitialize and that route would disappear. However, if you use the -p parameter along with the Add subcommand, the route will be added to the registry and will become a persistent route. In other words, it becomes a permanent part of the routing table. When you use the -p parameter along with the Print subcommand, the report displays only the persistent routes.

The Route command provides a set of subcommands that you can use to specify an action that the Route command should take. This set of subcommands includes Add, Change, Delete, and Print. The Add subcommand allows you to temporarily add a route to the routing table. You use the Change subcommand to modify an existing route in the routing table. The Delete subcommand allows you to remove a route from the routing table. Now the Print subcommand will provide you with a detailed report that shows the contents of the routing table. (When troubleshooting a TCP/IP connectivity problem, using the Print subcommand is a good place to start your investigation. I'll go into a bit more detail on the Print subcommand in a moment.)

Each of these subcommands, except the Print subcommand, requires a Destination argument, which is the IP address that specifies the network destination that is reachable via the gateway. When you specify a destination for the Print or Delete subcommands, you can use a complete address or use a partial address along with a wildcard. For example, if you want to see or delete only those entries in the routing table that start with 192, you could use 192.* as the destination argument.

The Mask parameter allows you to specify, as an argument, a netmask address (or subnet mask) for the route. If you don't specify a netmask address for the route, the default netmask address, 255.25.255.255, is used.

The Gateway argument stands alone in that it is not preceded with an explicit parameter and allows you to specify the address that the route is to use for traffic going to the destination.

The Metric parameter is used to specify, as an argument, a metric (or hop count) for a particular route. The metric value is used to determine the preferred route to follow when there are multiple routes to a destination and specifies the maximum number of hops that should exist between the local system and the gateway. The available route with the lowest metric is used

The If parameter is used to specify, as an argument, the index of the interface that the route is to use. You can use either decimal or hexadecimal values for the interface index. When the If parameter is omitted, the interface is determined from the gateway address.

The Print subcommand
As I mentioned, when troubleshooting a TCP/IP connectivity problem related to the routing table, using the Print subcommand is a good place to start your investigation. When you use the Print subcommand, you'll see a report similar to the one shown in Figure A.

Figure A
The Route Print command displays the current routing table on a local system.


At the top of this report you'll see the Interface List section, which contains the interface indexes for the Microsoft TCP Loopback adapter and, in the case of this example system, a 3Com Etherlink network adapter card. As you can see, these two adapters have interface indexes listed as hexadecimal values of 0x1 and 0x2, respectively.

The Active Routes section contains the routing table and provides insight on how the Route command's parameters actually function. Since the destination is the ultimate goal of the routing table, here's a closer look at the addresses listed in the Network Destination column.

Each address in Network Destination column from my example system is explained in Table A.

Table A: The destinations are shown in the Network Destination column.
Network Destination Description
0.0.0.0 Default route (This route is used when no other route is found.)
127.0.0.0 Loopback address
192.168.1.0 Local subnet address
192.168.1.102 Network card address
192.168.1.255 Subnet broadcast address
224.0.0.0 Multicast address
255.255.255.255 Limited broadcast address

In Figure A, the Netmask column shows a list of addresses that are applied to each Network Destination address. The Gateway column shows a list of IP addresses that act as the gateway for that route. The Interface column shows a list of IP address assigned to the network adapter that the route will follow when leaving the local system. The Metric column shows a list of the hop count between the local system and the gateway.

Downloading and installing the Route Utility
You can download the Route Utility by following this link or by clicking on the Downloads link in the navigation bar at the top of this page. (TechRepublic and TechProGuild have many useful documents, templates, and applications available for download, so be sure to check out our other offerings.)

Once you download the RouteUtility.zip archive file, manually installing the application on your hard disk is easy. To do so, create a folder called Route Utility. Then, unzip the RouteUtility.zip archive file and copy the route.ico and RouteUtility.txt files to the Route Utility folder. The route.ico file provides the Route Utility with the icon that it uses for the control menu and the taskbar. The RouteUtility.txt file is the main HTML application, but because many antivirus programs filter out HTA files, I have renamed it RouteUtility.txt. You must rename the RoutUtility.txt file to RouteUtility.hta before you can use the Route Utility program. Once you've renamed the file, simply double-click it to run the Route Utility program.

Using the Route Utility
Now that you have a pretty good idea of how the Route command works, let's take a look at how you can save yourself both time and frustration by using the Route Utility graphical user interface to easily configure and issue complex Route commands.

To launch the Route Utility, simply double-click on the HTA file. When you do, you'll see its main dialog box, as shown in Figure B. As you can see, the Route Utility contains a check box for each one of the Route command's parameters. There are also text boxes in which you can type the appropriate set of octet values, as well as other decimal or hexadecimal values.

Figure B
The Route Utility's dialog box has a check box for each one of the Route command's parameters, as well as text boxes to allow you to enter the appropriate values.


What's a set of octets?
Have you ever heard someone refer to an IP address as a set of octets and wondered what they were talking about? As you know, an IP address is presented in a decimal format sometimes called a dotted decimal number. This is a format that's easy for us to read. However, our computers convert these dotted decimal numbers into binary format. For example, a typical dotted decimal number IP address such as this one:

192.168.115.125

looks like this in binary format:

11000000.10101000.1110011.1111101

As you can see, in the case of this particular IP address, the conversion results in four sets of eight binary digits. A set of eight binary digits is also referred to as an octet. If you carry this one step further, you can see that this set of octets has 32 positions, which is why IP addresses are referred to as 32-bit numbers.


To see how you go about using the Route Utility as an interface to the Route command line tool, let's take a look at an example. Suppose that you want to add a route to the destination 10.41.0.0 with a subnet mask of 255.255.0.0, a gateway address of 10.27.0.1, and a metric of 7. If so, you would fill in the Route Utility's dialog box as shown in Figure C.

Figure C
Filling in the Route Utility's dialog box is much easier than typing on the DOS-based command line.


Once you fill in the dialog box, just click OK. When you do, you'll see what basically amounts to a confirmation dialog box, which shows you the exact command line that you've configured via the Route Utility and asks whether you want to execute it, as shown in Figure D.

Figure D
The Route Utility shows you the exact Route command line that you've configured and prompts you to execute it.


If the command isn't exactly what you wanted, click Cancel and you'll be returned to the main Route Utility dialog box. When you do, you'll see that everything is as you left it and you can modify your Route command line without having to start from scratch. Of course, you can remove any parameter by clearing the check box or add an additional parameter by selecting a check box.

When you click OK, you'll see the Command Prompt window appear on top of the Route Utility dialog box, and you'll see the results of your Route command. When you close the Command Prompt window, you'll once again see the Route Utility dialog box. This makes it easy to check your entry should the results not be not what you expected, and it also makes it easy to take a look at the modified routing table via the Print command. You can also continue to tweak the routing table. When you're finished, just click the Close button.

Getting quick help
If you need more details on any one of the Route command's parameters, just click OK in the Route Utility dialog box without selecting any check boxes. When you see the confirmation dialog box, it will only contain the Route command. Just click OK. When you do, the Command Prompt window will open and display the command line help for the Route command.

In addition, you can find a more detailed explanation of the Route command's parameters in the Windows XP Help and Support system, as well as on Microsoft's Windows XP Web site.


Troubleshooting the Route command
One last piece of advice: You should use caution when using the Route command to modify the routing table because one little mistake can really mess up your network communications. And to top it all off, the error messages displayed by the Route command leave a lot to be desired.

To help with this problem, I recently discovered a PDF file titled "Route command error messages," which is posted as a Web-based appendix to Niall Mansfield's excellent book, "Practical TCP/IP: Designing, Using, and Troubleshooting TCP/IP Networks on Linux and Windows." It's worth checking out.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

0 comments