You can use the route command to display or modify the computer’s routing table. If you’re having trouble accessing other computers or other networks, you can use the route command to make sure that a bad entry in the computer’s routing table isn’t the culprit. Besides displaying the routing table, the route command also lets you modify it by adding, deleting, or changing entries.

You shouldn’t do this unless you know what you’re doing. If you mess up the routing table, your computer may not be able to communicate with anyone.

The syntax for the route command for adding, deleting, or changing a route entry is

<b>route [-p]</b> command dest <b>[mask </b>subnet<b>]</b> gateway <b>[-if</b> interface<b>]</b>

The following list describes each of the route command’s parameters:

  • –p: Makes the entry persistent. If you omit -p, the entry will be deleted the next time you reboot. (Use this only with add commands.)

  • command: Add, delete, or change.

  • dest: The IP address of the destination subnet.

  • mask subnet: The subnet mask. If you omit the subnet mask, the default is, meaning that the entry will apply only to a single host rather than a subnet. You usually want to include the mask.

  • gateway: The IP address of the gateway to which packets will be sent.

  • -if interface: The IP address of the interface through which packets will be sent. If your computer has only one network interface, you can omit this.

Suppose that your network has a second router that serves as a link to another private subnet, (subnet mask The interface on the local side of this router is at To add a static route entry that sends packets intended for the subnet to this router, use a command like this:

C:>route -p add mask

Now, suppose that you later change the IP address of the router to You can update this route with the following command:

C:>route change mask

Notice that the mask is specified again. If you omit the mask from a route change command, the command changes the mask to!

Finally, suppose that you realize that setting up a second router on this network wasn’t such a good idea after all, so you want to just delete the entry. The following command will do the trick:

C:>route delete

About This Article

This article can be found in the category: