技術員聯(lián)盟提供win764位系統(tǒng)下載,win10,win7,xp,裝機純凈版,64位旗艦版,綠色軟件,免費軟件下載基地!

當前位置:主頁 > 教程 > 硬件教程 >

多個IP選擇線路的解決辦法之route命令

來源:技術員聯(lián)盟┆發(fā)布時間:2018-03-15 06:21┆點擊:

  一臺電腦兩條線路一個電信IP一個聯(lián)通的IP,解決訪問電信的時候自動走電信線路,訪問聯(lián)通的時候自動走聯(lián)通的線路,我們可以用到下面這個命令

  ROUTEDOS命令我們都可以在 Cmd 下用 route /? 來查看他的幫助信息

  先看一下他的幫助

  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

  route - 顯示 / 操作IP選路表

  總覽 SYNOPSIS

  route [-CFvnee]

  route [-v] [-A family] add [-net|-host] target [netmask Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I][reject] [mod] [dyn] [reinstate] [[dev] If]

  route [-v] [-A family] del [-net|-host] target [gw Gw][netmask Nm] [metric N] [[dev] If]

  route [-V] [--version] [-h] [--help]

  描述 DESCRIPTION

  route程序對內核的IP選路表進行操作。它主要用于通過已用ifconfig(8)程序配置好的接口來指定的主機或網絡設置靜態(tài)路由。

  選項 OPTIONS

  -v

  選用細節(jié)操作模式

  -A family

  用指定的地址族(如`inet',`inet6')。

  -n

  以數字形式代替解釋主機名形式來顯示地址。此項對試圖檢測對域名服務器進行路由發(fā)生故障的原因非常有用。

  -e

  用netstat(8)的格式來顯示選路表。-ee將產生包括選路表所有參數在內的大量信息。

  -net

  路由目標為網絡。

  -host

  路由目標為主機。

  -F

  顯示內核的FIB選路表。其格式可以用-e 和 -ee選項改變。

  -C

  顯示內核的路由緩存。

  del

  刪除一條路由。

  add

  添加一條路由。

  target

  指定目標網絡或主機??梢杂命c分十進制形式的IP地址或主機/網絡名。

  netmask Nm

  為添加的路由指定網絡掩碼。

  gw Gw

  為發(fā)往目標網絡/主機的任何分組指定網關。注意:指定的網關首先必須是可達的。也就是說必須為該網關預先指定一條靜態(tài)路由。如果你為本地接口之一指定這個網關地址的話,那么此網關地址將用于決定此接口上的分組將如何進行路由。這是BSD風格所兼容的。

  metric M

  把選路表中的路由值字段(由選路進程使用)設為M。

  mss M

  把基于此路由之上的連接的TCP最大報文段長度設為M字節(jié)。這通常只用于優(yōu)化選路設置。默認值為536。

  window W

  把基于此路由之上的連接的TCP窗口長度設為W字節(jié)。這通常只用于AX.25網絡和不能處理背對背形式的幀的設備。

  irtt I

  把基于此路由之上的TCP連接的初始往返時間設為I毫秒(1-12000)。這通常也只用于AX.25網絡。如果省略此選項,則使用RFC1122的缺省值300ms。

  reject

  設置一條阻塞路由以使一條路由查找失敗。這用于在使用缺省路由前先屏蔽掉一些網絡。但這并不起到防火墻的作用。

  mod, dyn, reinstate

  設置一條動態(tài)的或更改過的路由。這些標志通常只由選路進程來設置。這只用于診斷目的,

  dev If