route

This diagnostic command manipulates network routing tables.

Syntax

route [-f] [command [destination] [MASK netmask] [gateway] [METRIC metric]]

Parameters

-f

Clears the routing tables of all gateway entries. If this parameter is used in conjunction with one of the commands, the tables are cleared prior to running the command.

-p

When used with the route add command, makes a route persistent across restarts of the computer. By default, routes are not preserved when the computer is restarted. When used with the route print command, displays the list of registered persistent routes. Ignored for all other commands.

command

Specifies one of four commands.

Command

Purpose

print

Prints a route

add

Adds a route

delete

Deletes a route

change

Modifies an existing route


destination

Specifies the host to send command.

MASK

Specifies, if present, that the next parameter be interpreted as the netmask parameter.

netmask

Specifies, if present, the subnet mask value to be associated with this route entry. If not present, this parameter defaults to 255.255.255.255.

gateway

Specifies the gateway.

METRIC

Specifies the route metric (cost) for the destination.

Notes

The route utility does not accept a subnet mask value of 255.255.255.255 on the command line. To specify a subnet mask with this value, you must accept the default.

On a multihomed computer on which a network is available from more than one adapter card, all network traffic is passed over the first gateway defined. If you add a second gateway to the same network, the entry is added to the route table, but it is never used.

The route utility uses the Networks file to convert destination names to addresses. For the route utility to work correctly, the network numbers in the Networks file must specify all four octets in dotted decimal notation. For example, a network number of 284.122.107 must be specified in the Networks file as 284.122.107.0, with trailing zeroes appended.

All symbolic names used for destination or gateway are looked up in the network and host name database files NETWORKS and HOSTS, respectively. If the command is route print or route delete, wildcards may be used for the destination and gateway, or the gateway argument may be omitted.