• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Route \windows\system32\route.exe

Manipulate the TCP/IP routing table for the local computer.

To Open

Command Prompt route

Usage

route [-f] [-p] [command] [destination] [gateway]
    [mask 
                        netmask] [metric metric] [if interface]

Description

Routing tables provide information necessary to connect to other computers on a network or the Internet. Route accepts the following options:


command

Specifies one of four commands:


print

Prints a route (similar to netstat -r). The route print command is useful if you are having a problem (e.g., “Host Unreachable” or “Request timed out”) with the routes on your computer, since it will display all the different fields in the active route (see the example).


add

Adds a route to the routing table; used until the computer is shut down (unless the -p option is specified).


delete

Deletes a route from the routing table.


change

Modifies an existing route in the routing table.


destination

The remote computer that is reachable via gateway.


-f

Frees (clears) the routing tables of all gateway entries. If this is used in conjunction with one of the commands listed above, the tables are cleared prior to running the command.


-p

When used with the add command, -p makes a route persistent across boots of the system. If you don’t specify -p, any route you add will be valid only until the computer is restarted. The -p option has no effect on other commands, as they’re all persistent.


gateway

The gateway computer to be used for traffic going to destination. It is possible to use a hostname for the gateway, but it is safer to use an IP address, as a hostname may resolve to multiple IP addresses. For example, you might type the following:

route add 0.0.0.0 10.0.0.200


mask netmask

Specifies the subnet mask for a destination. If not specified, a mask of 255.255.255.255 is used (i.e., a “host route” to a single host, not a network).


metric metric

Specifies the metric or “hop count” for this route. The metric indicates which route is preferred when multiple routes to a destination exist and signifies the number of hops or gateways between the local computer and the gateway. The route with the lowest metric is used unless it is unavailable, in which case the route with the next lowest metric takes over.


if interface

Specifies the interface number for the specified route.

If you type route print at the command prompt, you’ll get something that looks like this:

Active Routes:
 Network Address Netmask Gateway Address Interface Metric
 0.0.0.0 0.0.0.0 172.16.80.5 172.16.80.150 1
 127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
 172.16.80.10 255.255.255.0 172.16.80.150 172.16.80.150 1
 172.16.80.150 255.255.255.255 127.0.0.1 127.0.0.1 1
 172.16.80.200 255.255.255.255 172.16.80.150 172.16.80.150 1
 224.0.0.0 224.0.0.0 172.16.80.150 172.16.80.150 1
 255.255.255.255 255.255.255.255 172.16.80.150 0.0.0.0 1

The fields in this printout are as follows:


Gateway Address

The IP address of the gateway for the route. The gateway will know what to do with traffic for the specified network address.


Interface

The IP address of the network interface that the route will use when leaving the local computer.


Metric

The hop count or number of gateways between the local computer and the gateway.


Netmask

The mask to be applied to the network address. If all ones (255.255.255.255), the route is a host route and refers to a single machine, not a network.


Network Address

Any network matched by this address should use this route. The default route is all zeros and is used if no other route is found.

Notes

If the command is print or delete, wildcards may be used for the destination and gateway or the gateway argument may be omitted.

See Also

“Tracert”

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint