ROUTE

(route)


控制网络路由表。该命令只有在安装了 TCP/IP 协议后才可以使用。

 

route [-f] [-p] [command [destination] [mask subnetmask] [gateway] [metric costmetric]

 

参数

 

-f 清除所有网关入口的路由表。如果该参数与某个命令组合使用,路由表将在运行命令前清除。

 

-p  该参数与 add 命令一起使用时,将使路由在系统引导程序之间持久存在。默认情况下,系统重新启动时不保留路由。与print 命令一起使用时,显示已注册的持久路由列表。忽略其他所有总是影响相应持久路由的命令。

 

command 指定下列的命令:

命令 目的

 

print 打印路由

 

add 添加路由

 

delete 删除路由

 

change 更改现存路由

 

destination 指定发送 command 的计算机。

 

mask subnetmask 指定与该路由条目关联的子网掩码。如果没有指定,将使用 255.255.255.255

 

gateway 指定网关。

 

名为 Networks 的网络数据库文件和名为 Hosts 的计算机名数据库文件中均引用全部 destination gateway 使用的符号名称。如果命令是 print delete,目标和网关还可以使用通配符,也可以省略网关参数。

 

metric costmetric 指派整数跃点数(从 1 9999)在计算快速、最可*和(或)最便宜的路由时使用。

 


 

Manipulates network routing tables.

 

ROUTE [-f] [-p] [command [destination]

                  [MASK netmask]  [gateway] [METRIC metric]  [IF interface]

 

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

  -p           When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted.

Ignored for all other commands,which always affect the appropriate persistent routes. This option is not supported in Windows 95.

  command      One of these:

                  PRINT       Prints     a route

                  ADD         Adds      a route

                  DELETE     Deletes   a route

                  CHANGE    Modifies an existing route

  destination  Specifies the host.

  MASK         Specifies that the next parameter is the 'netmask' value.

  netmask      Specifies a subnet mask value for this route entry.

               If not specified, it defaults to 255.255.255.255.

  gateway      Specifies gateway.

  interface    the interface number for the specified route.

  METRIC       specifies the metric, ie. cost for the destination.

 

All symbolic names used for destination are looked up in the network database file NETWORKS. The symbolic names for gateway are looked up in the host name database file HOSTS.

 

If the command is PRINT or DELETE. Destination or gateway can be a wildcard,(wildcard is specified as a star '*'), or the gateway argument may be omitted.

 

If Dest contains a * or ?, it is treated as a shell pattern, and only matching destination routes are printed. The '*' matches any string, and '?' matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.

Diagnostic Notes:

    Invalid MASK generates an error, that is when (DEST & MASK) != DEST.

    Example> route ADD 157.0.0.0 MASK 155.0.0.0 157.55.80.1 IF 1

             The route addition failed: The specified mask parameter is invalid.

 (Destination & Mask) != Destination.

 

Examples:

 

    > route PRINT

    > route ADD 157.0.0.0 MASK 255.0.0.0  157.55.80.1 METRIC 3 IF 2

             destination^      ^mask      ^gateway     metric^    ^

                                                         Interface^

      If IF is not given, it tries to find the best interface for a given

      gateway.

    > route PRINT

    > route PRINT 157*          .... Only prints those matching 157*

    > route CHANGE 157.0.0.0 MASK 255.0.0.0 157.55.80.5 METRIC 2 IF 2

 

      CHANGE is used to modify gateway and/or metric only.

    > route PRINT

    > route DELETE 157.0.0.0

    > route PRINT