Windows Route 路由表命令整理
更新時(shí)間:2012年03月01日 23:09:27 作者:
Windows Route 路由表命令 在本地 IP 路由表中顯示和修改條目
Windows Route 路由表命令
在本地 IP 路由表中顯示和修改條目。
語(yǔ)法
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
參數(shù)
-f
清除所有不是主路由(網(wǎng)掩碼為 255.255.255.255 的路由)、環(huán)回網(wǎng)絡(luò)路由(目標(biāo)為 127.0.0.0,網(wǎng)掩碼為 255.255.255.0 的路由)或多播路由(目標(biāo)為 224.0.0.0,網(wǎng)掩碼為 240.0.0.0 的路由)的條目的路由表。如果它與命令之一(例如 add、change 或 delete)結(jié)合使用,表會(huì)在運(yùn)行命令之前清除。
-p
與 add 命令共同使用時(shí),指定路由被添加到注冊(cè)表并在啟動(dòng) TCP/IP 協(xié)議的時(shí)候初始化 IP 路由表。默認(rèn)情況下,啟動(dòng) TCP/IP 協(xié)議時(shí)不會(huì)保存添加的路由。與 print 命令一起使用時(shí),則顯示永久路由列表。所有其它的命令都忽略此參數(shù)。永久路由存儲(chǔ)在注冊(cè)表中的位置是 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes。
Command
指定要運(yùn)行的命令。下表列出了有效的命令。 命令 目的
add 添加路由
change 更改現(xiàn)存路由
delete 刪除路由
print 打印路由Destination
指定路由的網(wǎng)絡(luò)目標(biāo)地址。目標(biāo)地址可以是一個(gè) IP 網(wǎng)絡(luò)地址(其中網(wǎng)絡(luò)地址的主機(jī)地址位設(shè)置為 0),對(duì)于主機(jī)路由是 IP 地址,對(duì)于默認(rèn)路由是 0.0.0.0。
mask subnetmask
指定與網(wǎng)絡(luò)目標(biāo)地址相關(guān)聯(lián)的網(wǎng)掩碼(又稱之為子網(wǎng)掩碼)。子網(wǎng)掩碼對(duì)于 IP 網(wǎng)絡(luò)地址可以是一適當(dāng)?shù)淖泳W(wǎng)掩碼,對(duì)于主機(jī)路由是 255.255.255.255 ,對(duì)于默認(rèn)路由是 0.0.0.0。如果忽略,則使用子網(wǎng)掩碼 255.255.255.255。定義路由時(shí)由于目標(biāo)地址和子網(wǎng)掩碼之間的關(guān)系,目標(biāo)地址不能比它對(duì)應(yīng)的子網(wǎng)掩碼更為詳細(xì)。換句話說(shuō),如果子網(wǎng)掩碼的一位是 0,則目標(biāo)地址中的對(duì)應(yīng)位就不能設(shè)置為 1。
Gateway
指定超過(guò)由網(wǎng)絡(luò)目標(biāo)和子網(wǎng)掩碼定義的可達(dá)到的地址集的前一個(gè)或下一個(gè)躍點(diǎn) IP 地址。對(duì)于本地連接的子網(wǎng)路由,網(wǎng)關(guān)地址是分配給連接子網(wǎng)接口的 IP 地址。對(duì)于要經(jīng)過(guò)一個(gè)或多個(gè)路由器才可用到的遠(yuǎn)程路由,網(wǎng)關(guān)地址是一個(gè)分配給相鄰路由器的、可直接達(dá)到的 IP 地址。
metric Metric
為路由指定所需躍點(diǎn)數(shù)的整數(shù)值(范圍是 1 ~ 9999),它用來(lái)在路由表里的多個(gè)路由中選擇與轉(zhuǎn)發(fā)包中的目標(biāo)地址最為匹配的路由。所選的路由具有最少的躍點(diǎn)數(shù)。躍點(diǎn)數(shù)能夠反映躍點(diǎn)的數(shù)量、路徑的速度、路徑可靠性、路徑吞吐量以及管理屬性。
if Interface
指定目標(biāo)可以到達(dá)的接口的接口索引。使用 route print 命令可以顯示接口及其對(duì)應(yīng)接口索引的列表。對(duì)于接口索引可以使用十進(jìn)制或十六進(jìn)制的值。對(duì)于十六進(jìn)制值,要在十六進(jìn)制數(shù)的前面加上 0x。忽略 if 參數(shù)時(shí),接口由網(wǎng)關(guān)地址確定。
/?
在命令提示符顯示幫助。
注釋
路由表中 躍點(diǎn)數(shù) 一列的值較大是由于允許 TCP/IP 根據(jù)每個(gè) LAN接口的 IP 地址、子網(wǎng)掩碼和默認(rèn)網(wǎng)關(guān)的配置自動(dòng)確定路由表中路由的躍點(diǎn)數(shù)造成的。默認(rèn)啟動(dòng)的自動(dòng)確定接口躍點(diǎn)數(shù)確定了每個(gè)接口的速度,調(diào)整了每個(gè)接口的路由躍點(diǎn)數(shù),因此最快接口所創(chuàng)建的路由具有最低的躍點(diǎn)數(shù)。要?jiǎng)h除大躍點(diǎn)數(shù),請(qǐng)?jiān)诿總€(gè) LAN 連接的 TCP/IP 協(xié)議的高級(jí)屬性中禁用自動(dòng)確定接口躍點(diǎn)數(shù)。
如果在 systemroot\System32\Drivers\Etc 文件夾的本地網(wǎng)絡(luò)文件中存在適當(dāng)?shù)臈l目,名稱可以用于 Destination。只要名稱可以通過(guò)“域名系統(tǒng)” (DNS) 查詢這樣的標(biāo)準(zhǔn)主機(jī)名解析技術(shù)分解為 IP 地址,就可以將其用于 Gateway,DNS 查詢使用存儲(chǔ)在 systemroot\System32\Drivers\Etc 文件夾下的本地主機(jī)文件和 NetBIOS 名稱解析。
如果是 print 或 delete 命令,可以忽略 Gateway 參數(shù),使用通配符來(lái)表示目標(biāo)和網(wǎng)關(guān)。Destination 的值可以是由星號(hào) (*) 指定的通配符。如果指定目標(biāo)含有一個(gè)星號(hào) (*) 或問(wèn)號(hào) (?),它被看作是通配符,只打印或刪除匹配的目標(biāo)路由。星號(hào)代表任意一字符序列,問(wèn)號(hào)代表任一字符。例如, 10.*.1, 192.168.*、 127.* 和 *224* 都是星號(hào)通配符的有效使用。
使用了無(wú)效的目標(biāo)和子網(wǎng)掩碼(網(wǎng)掩碼)值的組合,會(huì)顯示“Route:bad gateway address netmask”錯(cuò)誤消息。目標(biāo)中有一位或多位設(shè)置為 1,而其在子網(wǎng)掩碼中的對(duì)應(yīng)位設(shè)置為 0 時(shí)會(huì)發(fā)生這個(gè)錯(cuò)誤。可以通過(guò)二進(jìn)制表示法表示目標(biāo)和子網(wǎng)掩碼來(lái)檢查這種情況。以二進(jìn)制表示的子網(wǎng)掩碼包括表示目標(biāo)網(wǎng)絡(luò)地址部分的一連串的 1 和表示目標(biāo)主機(jī)地址部分的一連串的 0 兩個(gè)部分。查看目標(biāo)以確定目標(biāo)的主機(jī)地址部分(由子網(wǎng)掩碼所定義)是否有些位設(shè)置成了 1。
只有 Windows NT 4.0、Windows 2000、Windows Millennium Edition 和 Windows XP 的 route 命令支持 -p 參數(shù)。Windows 95 或 Windows 98 的 route 命令不支持該參數(shù)。
只有當(dāng)網(wǎng)際協(xié)議 (TCP/IP) 協(xié)議在 網(wǎng)絡(luò)連接中安裝為網(wǎng)絡(luò)適配器屬性的組件時(shí),該命令才可用。
范例
要顯示 IP 路由表的完整內(nèi)容,請(qǐng)鍵入:
route print
要顯示 IP 路由表中以 10. 開始的路由,請(qǐng)鍵入:
route print 10.*
要添加默認(rèn)網(wǎng)關(guān)地址為 192.168.12.1 的默認(rèn)路由,請(qǐng)鍵入:
route add 0.0.0.0 mask 0.0.0.0 192.168.12.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1 的永久路由,請(qǐng)鍵入:
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1,躍點(diǎn)數(shù)為 7 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1,接口索引為 0x3 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
要?jiǎng)h除目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0 的路由,請(qǐng)鍵入:
route delete 10.41.0.0 mask 255.255.0.0
要?jiǎng)h除 IP 路由表中以 10. 開始的所有路由,請(qǐng)鍵入:
route delete 10.*
要將目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0 的路由的下一個(gè)躍點(diǎn)地址由 10.27.0.1 更改為 10.27.0.25,請(qǐng)鍵入:
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
route 的命令
routing ip add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示常規(guī) IP 路由設(shè)置。
routing ip add/delete/set/show filter 在指定接口上添加、刪除、配置或顯示 IP 數(shù)據(jù)包篩選器。
routing ip add/delete/show boundary 在指定接口上添加、刪除或顯示多播邊界設(shè)置。
routing ip add/set ipiptunnel 添加或配置 IP 中的 IP 接口。
routing ip add/delete/set/show rtmroute 添加、配置或顯示不持續(xù)的路由表管理器路由。
routing ip add/delete/set/show persistentroute 添加、刪除、配置或顯示持續(xù)路由。
routing ip add/delete/set/show preferenceforprotocol 添加、刪除、配置或顯示路由協(xié)議的優(yōu)先級(jí)。
routing ip add/delete/set/show scope 添加、刪除或顯示多播作用域。
routing ip set/show loglevel 配置或顯示全局 IP 記錄等級(jí)。
routing ip show helper 顯示 IP 的所有 Netsh 實(shí)用程序子環(huán)境。
routing ip show protocol 顯示所有正在運(yùn)行的 IP 路由協(xié)議。
routing ip show mfe 顯示多播轉(zhuǎn)發(fā)項(xiàng)。
routing ip show mfestats 顯示多播轉(zhuǎn)發(fā)項(xiàng)統(tǒng)計(jì)。
routing ip show boundarystats 顯示 IP 多播邊界。
routing ip show rtmdestinations 顯示路由表管理器路由表中的目標(biāo)。
routing ip show rtmroutes 顯示路由表管理器路由表中的路由。
routing ip nat set/show global 配置或顯示全局網(wǎng)絡(luò)地址轉(zhuǎn)換 (NAT) 設(shè)置。
routing ip nat add/delete/set/show interface 添加、刪除、配置或顯示指定接口的 NAT 設(shè)置。
routing ip nat add/delete addressrange 在 NAT 接口公用地址池中添加或刪除一個(gè)地址范圍。
routing ip nat add/delete addressmapping 添加或刪除 NAT 地址映射。
routing ip nat add/delete portmapping 添加或刪除 NAT 端口映射。
routing ip autodhcp set/show global 配置或顯示全局 DHCP 分配器參數(shù)。
routing ip autodhcp set/show interface 配置或顯示指定接口的 DHCP 分配器設(shè)置。
routing ip autodhcp add/delete exclusion 在 DHCP 分配器地址范圍中添加或刪除一個(gè)排除范圍。
routing ip dnsproxy set/show global 配置或顯示全局 DNS 代理參數(shù)。
routing ip dnsproxy set/show interface 配置或顯示指定接口的 DNS 代理參數(shù)。
routing ip igmp set/show global 配置或顯示 IGMP 全局設(shè)置。
routing ip igmp add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示 IGMP。
routing ip igmp add/delete staticgroup 添加或刪除指定接口的靜態(tài)多播組。
routing ip igmp show grouptable 顯示 IGMP 主機(jī)組表。
routing ip igmp show ifstats 顯示每個(gè)接口的 IGMP 統(tǒng)計(jì)。
routing ip igmp show iftable 顯示每個(gè)接口的 IGMP 主機(jī)組。
routing ip igmp show proxygrouptable 顯示 IGMP 代理接口的 IGMP 組表。
routing ip igmp show rasgrouptable 顯示遠(yuǎn)程訪問(wèn)服務(wù)器所使用的 Internet 接口的組表。
routing ip ospf set/show global 配置或顯示全局 OSPF 設(shè)置。
routing ip ospf add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示 OSPF。
routing ip ospf add/delete/set/show area 添加、刪除、配置或顯示 OSPF 區(qū)域。
routing ip ospf add/delete/show range 在指定的 OSPF 區(qū)域上添加、刪除、配置或顯示范圍。
routing ip ospf add/delete/set/show virtif 添加、刪除、配置或顯示 OSPF 虛擬接口。
routing ip ospf add/delete/show neighbor 添加、刪除、配置或顯示 OSPF 鄰居。
routing ip ospf add/delete/show protofilter 添加、刪除、配置或顯示 OSPF 外部路由的路由信息源。
routing ip ospf add/delete/show routefilter 添加、刪除、配置或顯示 OSPF 外部路由的路由篩選。
routing ip ospf show areastats 顯示 OSPF 區(qū)域統(tǒng)計(jì)。
routing ip ospf show lsdb 顯示 OSPF 鏈接狀態(tài)數(shù)據(jù)庫(kù)。
routing ip ospf show virtifstats 顯示 OSPF 虛擬鏈接統(tǒng)計(jì)。
routing ip relay set global 配置“DHCP 中繼代理程序”的全局設(shè)置。
routing ip relay add/delete/set interface 在指定接口上添加、刪除或配置“DHCP 中繼代理程序”設(shè)置。
routing ip relay add/delete dhcpserver 在 DHCP 服務(wù)器地址列表中添加或刪除 DHCP 服務(wù)器的 IP 地址。
routing ip relay show ifbinding 顯示接口的 IP 地址綁定。
routing ip relay show ifconfig 顯示每個(gè)接口的“DHCP 中繼代理程序”配置。
routing ip relay show ifstats 顯示每個(gè)接口的 DHCP 統(tǒng)計(jì)。
routing ip rip set/show global 配置 IP 的 RIP 全局設(shè)置。
routing ip rip add/delete/set/show interface 在指定接口上添加或配置 IP 的 RIP 設(shè)置。
routing ip rip add/delete peerfilter 添加或刪除 RIP 對(duì)等篩選器。
routing ip rip add/delete acceptfilter 在接受的路由列表中添加或刪除 RIP 路由篩選器。
routing ip rip add/delete announcefilter 在公布的路由列表中添加或刪除 RIP 路由篩選器。
routing ip rip add/delete/show neighbor 添加或刪除 RIP 鄰居。
routing ip rip set/show flags 在指定接口上配置 IP RIP 高級(jí)設(shè)置。
routing ip rip show globalstats 顯示全局 RIP 參數(shù)。
routing ip rip show ifbinding 顯示接口的 IP 地址綁定。
routing ip rip show ifstats 顯示每個(gè)接口的 RIP 統(tǒng)計(jì)。
IPX netsh 路由命令
routing ipx add/set staticroute 在 IPX 路由表中添加或配置靜態(tài) IPX 路由。
routing ipx add/set staticservice 在 SAP 服務(wù)表中添加或配置靜態(tài) SAP 服務(wù)。
routing ipx add/set filter 在指定的接口上添加或配置 IPX 數(shù)據(jù)包篩選器。
routing ipx add/set interface 在請(qǐng)求撥號(hào)接口上啟用 IPX 路由,或在指定的接口上配置 IPX 設(shè)置。
routing ipx set global 配置全局 IPX 路由設(shè)置。
routing ipx rip add/set filter 添加和配置 RIP 路由篩選器。
routing ipx rip set global 配置全局 IPX 的 RIP 設(shè)置。
routing ipx rip set interface 在指定接口上配置 IPX 的 RIP 設(shè)置。
routing ipx sap add/set filter 添加或配置 SAP 服務(wù)篩選器。
routing ipx sap set global 配置全局 IPX 的 SAP 設(shè)置。
routing ipx sap set interface 在指定接口上配置 IPX 的 SAP 設(shè)置。
routing ipx netbios add nbname 將靜態(tài) NETBIOS 名稱添加到 IPX NetBIOS 名稱表中。
routing ipx netbios set interface 在指定接口上配置基于 IPX 的 NetBIOS 設(shè)置。
route 英式說(shuō)明幫助
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*.
The PRINT command will show both IPv4 and IPv6 routes, but the ADD, DELETE,
and CHANGE commands work only for IPv4 routes. For IPv6 routes, use
the 'interface ipv6' context in netsh.exe.
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
在本地 IP 路由表中顯示和修改條目。
語(yǔ)法
route [-f] [-p] [Command [Destination] [mask Netmask] [Gateway] [metric Metric]] [if Interface]]
參數(shù)
-f
清除所有不是主路由(網(wǎng)掩碼為 255.255.255.255 的路由)、環(huán)回網(wǎng)絡(luò)路由(目標(biāo)為 127.0.0.0,網(wǎng)掩碼為 255.255.255.0 的路由)或多播路由(目標(biāo)為 224.0.0.0,網(wǎng)掩碼為 240.0.0.0 的路由)的條目的路由表。如果它與命令之一(例如 add、change 或 delete)結(jié)合使用,表會(huì)在運(yùn)行命令之前清除。
-p
與 add 命令共同使用時(shí),指定路由被添加到注冊(cè)表并在啟動(dòng) TCP/IP 協(xié)議的時(shí)候初始化 IP 路由表。默認(rèn)情況下,啟動(dòng) TCP/IP 協(xié)議時(shí)不會(huì)保存添加的路由。與 print 命令一起使用時(shí),則顯示永久路由列表。所有其它的命令都忽略此參數(shù)。永久路由存儲(chǔ)在注冊(cè)表中的位置是 HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\PersistentRoutes。
Command
指定要運(yùn)行的命令。下表列出了有效的命令。 命令 目的
add 添加路由
change 更改現(xiàn)存路由
delete 刪除路由
print 打印路由Destination
指定路由的網(wǎng)絡(luò)目標(biāo)地址。目標(biāo)地址可以是一個(gè) IP 網(wǎng)絡(luò)地址(其中網(wǎng)絡(luò)地址的主機(jī)地址位設(shè)置為 0),對(duì)于主機(jī)路由是 IP 地址,對(duì)于默認(rèn)路由是 0.0.0.0。
mask subnetmask
指定與網(wǎng)絡(luò)目標(biāo)地址相關(guān)聯(lián)的網(wǎng)掩碼(又稱之為子網(wǎng)掩碼)。子網(wǎng)掩碼對(duì)于 IP 網(wǎng)絡(luò)地址可以是一適當(dāng)?shù)淖泳W(wǎng)掩碼,對(duì)于主機(jī)路由是 255.255.255.255 ,對(duì)于默認(rèn)路由是 0.0.0.0。如果忽略,則使用子網(wǎng)掩碼 255.255.255.255。定義路由時(shí)由于目標(biāo)地址和子網(wǎng)掩碼之間的關(guān)系,目標(biāo)地址不能比它對(duì)應(yīng)的子網(wǎng)掩碼更為詳細(xì)。換句話說(shuō),如果子網(wǎng)掩碼的一位是 0,則目標(biāo)地址中的對(duì)應(yīng)位就不能設(shè)置為 1。
Gateway
指定超過(guò)由網(wǎng)絡(luò)目標(biāo)和子網(wǎng)掩碼定義的可達(dá)到的地址集的前一個(gè)或下一個(gè)躍點(diǎn) IP 地址。對(duì)于本地連接的子網(wǎng)路由,網(wǎng)關(guān)地址是分配給連接子網(wǎng)接口的 IP 地址。對(duì)于要經(jīng)過(guò)一個(gè)或多個(gè)路由器才可用到的遠(yuǎn)程路由,網(wǎng)關(guān)地址是一個(gè)分配給相鄰路由器的、可直接達(dá)到的 IP 地址。
metric Metric
為路由指定所需躍點(diǎn)數(shù)的整數(shù)值(范圍是 1 ~ 9999),它用來(lái)在路由表里的多個(gè)路由中選擇與轉(zhuǎn)發(fā)包中的目標(biāo)地址最為匹配的路由。所選的路由具有最少的躍點(diǎn)數(shù)。躍點(diǎn)數(shù)能夠反映躍點(diǎn)的數(shù)量、路徑的速度、路徑可靠性、路徑吞吐量以及管理屬性。
if Interface
指定目標(biāo)可以到達(dá)的接口的接口索引。使用 route print 命令可以顯示接口及其對(duì)應(yīng)接口索引的列表。對(duì)于接口索引可以使用十進(jìn)制或十六進(jìn)制的值。對(duì)于十六進(jìn)制值,要在十六進(jìn)制數(shù)的前面加上 0x。忽略 if 參數(shù)時(shí),接口由網(wǎng)關(guān)地址確定。
/?
在命令提示符顯示幫助。
注釋
路由表中 躍點(diǎn)數(shù) 一列的值較大是由于允許 TCP/IP 根據(jù)每個(gè) LAN接口的 IP 地址、子網(wǎng)掩碼和默認(rèn)網(wǎng)關(guān)的配置自動(dòng)確定路由表中路由的躍點(diǎn)數(shù)造成的。默認(rèn)啟動(dòng)的自動(dòng)確定接口躍點(diǎn)數(shù)確定了每個(gè)接口的速度,調(diào)整了每個(gè)接口的路由躍點(diǎn)數(shù),因此最快接口所創(chuàng)建的路由具有最低的躍點(diǎn)數(shù)。要?jiǎng)h除大躍點(diǎn)數(shù),請(qǐng)?jiān)诿總€(gè) LAN 連接的 TCP/IP 協(xié)議的高級(jí)屬性中禁用自動(dòng)確定接口躍點(diǎn)數(shù)。
如果在 systemroot\System32\Drivers\Etc 文件夾的本地網(wǎng)絡(luò)文件中存在適當(dāng)?shù)臈l目,名稱可以用于 Destination。只要名稱可以通過(guò)“域名系統(tǒng)” (DNS) 查詢這樣的標(biāo)準(zhǔn)主機(jī)名解析技術(shù)分解為 IP 地址,就可以將其用于 Gateway,DNS 查詢使用存儲(chǔ)在 systemroot\System32\Drivers\Etc 文件夾下的本地主機(jī)文件和 NetBIOS 名稱解析。
如果是 print 或 delete 命令,可以忽略 Gateway 參數(shù),使用通配符來(lái)表示目標(biāo)和網(wǎng)關(guān)。Destination 的值可以是由星號(hào) (*) 指定的通配符。如果指定目標(biāo)含有一個(gè)星號(hào) (*) 或問(wèn)號(hào) (?),它被看作是通配符,只打印或刪除匹配的目標(biāo)路由。星號(hào)代表任意一字符序列,問(wèn)號(hào)代表任一字符。例如, 10.*.1, 192.168.*、 127.* 和 *224* 都是星號(hào)通配符的有效使用。
使用了無(wú)效的目標(biāo)和子網(wǎng)掩碼(網(wǎng)掩碼)值的組合,會(huì)顯示“Route:bad gateway address netmask”錯(cuò)誤消息。目標(biāo)中有一位或多位設(shè)置為 1,而其在子網(wǎng)掩碼中的對(duì)應(yīng)位設(shè)置為 0 時(shí)會(huì)發(fā)生這個(gè)錯(cuò)誤。可以通過(guò)二進(jìn)制表示法表示目標(biāo)和子網(wǎng)掩碼來(lái)檢查這種情況。以二進(jìn)制表示的子網(wǎng)掩碼包括表示目標(biāo)網(wǎng)絡(luò)地址部分的一連串的 1 和表示目標(biāo)主機(jī)地址部分的一連串的 0 兩個(gè)部分。查看目標(biāo)以確定目標(biāo)的主機(jī)地址部分(由子網(wǎng)掩碼所定義)是否有些位設(shè)置成了 1。
只有 Windows NT 4.0、Windows 2000、Windows Millennium Edition 和 Windows XP 的 route 命令支持 -p 參數(shù)。Windows 95 或 Windows 98 的 route 命令不支持該參數(shù)。
只有當(dāng)網(wǎng)際協(xié)議 (TCP/IP) 協(xié)議在 網(wǎng)絡(luò)連接中安裝為網(wǎng)絡(luò)適配器屬性的組件時(shí),該命令才可用。
范例
要顯示 IP 路由表的完整內(nèi)容,請(qǐng)鍵入:
route print
要顯示 IP 路由表中以 10. 開始的路由,請(qǐng)鍵入:
route print 10.*
要添加默認(rèn)網(wǎng)關(guān)地址為 192.168.12.1 的默認(rèn)路由,請(qǐng)鍵入:
route add 0.0.0.0 mask 0.0.0.0 192.168.12.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1 的永久路由,請(qǐng)鍵入:
route -p add 10.41.0.0 mask 255.255.0.0 10.27.0.1
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1,躍點(diǎn)數(shù)為 7 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 metric 7
要添加目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0,下一個(gè)躍點(diǎn)地址為 10.27.0.1,接口索引為 0x3 的路由,請(qǐng)鍵入:
route add 10.41.0.0 mask 255.255.0.0 10.27.0.1 if 0x3
要?jiǎng)h除目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0 的路由,請(qǐng)鍵入:
route delete 10.41.0.0 mask 255.255.0.0
要?jiǎng)h除 IP 路由表中以 10. 開始的所有路由,請(qǐng)鍵入:
route delete 10.*
要將目標(biāo)為 10.41.0.0,子網(wǎng)掩碼為 255.255.0.0 的路由的下一個(gè)躍點(diǎn)地址由 10.27.0.1 更改為 10.27.0.25,請(qǐng)鍵入:
route change 10.41.0.0 mask 255.255.0.0 10.27.0.25
route 的命令
routing ip add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示常規(guī) IP 路由設(shè)置。
routing ip add/delete/set/show filter 在指定接口上添加、刪除、配置或顯示 IP 數(shù)據(jù)包篩選器。
routing ip add/delete/show boundary 在指定接口上添加、刪除或顯示多播邊界設(shè)置。
routing ip add/set ipiptunnel 添加或配置 IP 中的 IP 接口。
routing ip add/delete/set/show rtmroute 添加、配置或顯示不持續(xù)的路由表管理器路由。
routing ip add/delete/set/show persistentroute 添加、刪除、配置或顯示持續(xù)路由。
routing ip add/delete/set/show preferenceforprotocol 添加、刪除、配置或顯示路由協(xié)議的優(yōu)先級(jí)。
routing ip add/delete/set/show scope 添加、刪除或顯示多播作用域。
routing ip set/show loglevel 配置或顯示全局 IP 記錄等級(jí)。
routing ip show helper 顯示 IP 的所有 Netsh 實(shí)用程序子環(huán)境。
routing ip show protocol 顯示所有正在運(yùn)行的 IP 路由協(xié)議。
routing ip show mfe 顯示多播轉(zhuǎn)發(fā)項(xiàng)。
routing ip show mfestats 顯示多播轉(zhuǎn)發(fā)項(xiàng)統(tǒng)計(jì)。
routing ip show boundarystats 顯示 IP 多播邊界。
routing ip show rtmdestinations 顯示路由表管理器路由表中的目標(biāo)。
routing ip show rtmroutes 顯示路由表管理器路由表中的路由。
routing ip nat set/show global 配置或顯示全局網(wǎng)絡(luò)地址轉(zhuǎn)換 (NAT) 設(shè)置。
routing ip nat add/delete/set/show interface 添加、刪除、配置或顯示指定接口的 NAT 設(shè)置。
routing ip nat add/delete addressrange 在 NAT 接口公用地址池中添加或刪除一個(gè)地址范圍。
routing ip nat add/delete addressmapping 添加或刪除 NAT 地址映射。
routing ip nat add/delete portmapping 添加或刪除 NAT 端口映射。
routing ip autodhcp set/show global 配置或顯示全局 DHCP 分配器參數(shù)。
routing ip autodhcp set/show interface 配置或顯示指定接口的 DHCP 分配器設(shè)置。
routing ip autodhcp add/delete exclusion 在 DHCP 分配器地址范圍中添加或刪除一個(gè)排除范圍。
routing ip dnsproxy set/show global 配置或顯示全局 DNS 代理參數(shù)。
routing ip dnsproxy set/show interface 配置或顯示指定接口的 DNS 代理參數(shù)。
routing ip igmp set/show global 配置或顯示 IGMP 全局設(shè)置。
routing ip igmp add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示 IGMP。
routing ip igmp add/delete staticgroup 添加或刪除指定接口的靜態(tài)多播組。
routing ip igmp show grouptable 顯示 IGMP 主機(jī)組表。
routing ip igmp show ifstats 顯示每個(gè)接口的 IGMP 統(tǒng)計(jì)。
routing ip igmp show iftable 顯示每個(gè)接口的 IGMP 主機(jī)組。
routing ip igmp show proxygrouptable 顯示 IGMP 代理接口的 IGMP 組表。
routing ip igmp show rasgrouptable 顯示遠(yuǎn)程訪問(wèn)服務(wù)器所使用的 Internet 接口的組表。
routing ip ospf set/show global 配置或顯示全局 OSPF 設(shè)置。
routing ip ospf add/delete/set/show interface 在指定接口上添加、刪除、配置或顯示 OSPF。
routing ip ospf add/delete/set/show area 添加、刪除、配置或顯示 OSPF 區(qū)域。
routing ip ospf add/delete/show range 在指定的 OSPF 區(qū)域上添加、刪除、配置或顯示范圍。
routing ip ospf add/delete/set/show virtif 添加、刪除、配置或顯示 OSPF 虛擬接口。
routing ip ospf add/delete/show neighbor 添加、刪除、配置或顯示 OSPF 鄰居。
routing ip ospf add/delete/show protofilter 添加、刪除、配置或顯示 OSPF 外部路由的路由信息源。
routing ip ospf add/delete/show routefilter 添加、刪除、配置或顯示 OSPF 外部路由的路由篩選。
routing ip ospf show areastats 顯示 OSPF 區(qū)域統(tǒng)計(jì)。
routing ip ospf show lsdb 顯示 OSPF 鏈接狀態(tài)數(shù)據(jù)庫(kù)。
routing ip ospf show virtifstats 顯示 OSPF 虛擬鏈接統(tǒng)計(jì)。
routing ip relay set global 配置“DHCP 中繼代理程序”的全局設(shè)置。
routing ip relay add/delete/set interface 在指定接口上添加、刪除或配置“DHCP 中繼代理程序”設(shè)置。
routing ip relay add/delete dhcpserver 在 DHCP 服務(wù)器地址列表中添加或刪除 DHCP 服務(wù)器的 IP 地址。
routing ip relay show ifbinding 顯示接口的 IP 地址綁定。
routing ip relay show ifconfig 顯示每個(gè)接口的“DHCP 中繼代理程序”配置。
routing ip relay show ifstats 顯示每個(gè)接口的 DHCP 統(tǒng)計(jì)。
routing ip rip set/show global 配置 IP 的 RIP 全局設(shè)置。
routing ip rip add/delete/set/show interface 在指定接口上添加或配置 IP 的 RIP 設(shè)置。
routing ip rip add/delete peerfilter 添加或刪除 RIP 對(duì)等篩選器。
routing ip rip add/delete acceptfilter 在接受的路由列表中添加或刪除 RIP 路由篩選器。
routing ip rip add/delete announcefilter 在公布的路由列表中添加或刪除 RIP 路由篩選器。
routing ip rip add/delete/show neighbor 添加或刪除 RIP 鄰居。
routing ip rip set/show flags 在指定接口上配置 IP RIP 高級(jí)設(shè)置。
routing ip rip show globalstats 顯示全局 RIP 參數(shù)。
routing ip rip show ifbinding 顯示接口的 IP 地址綁定。
routing ip rip show ifstats 顯示每個(gè)接口的 RIP 統(tǒng)計(jì)。
IPX netsh 路由命令
routing ipx add/set staticroute 在 IPX 路由表中添加或配置靜態(tài) IPX 路由。
routing ipx add/set staticservice 在 SAP 服務(wù)表中添加或配置靜態(tài) SAP 服務(wù)。
routing ipx add/set filter 在指定的接口上添加或配置 IPX 數(shù)據(jù)包篩選器。
routing ipx add/set interface 在請(qǐng)求撥號(hào)接口上啟用 IPX 路由,或在指定的接口上配置 IPX 設(shè)置。
routing ipx set global 配置全局 IPX 路由設(shè)置。
routing ipx rip add/set filter 添加和配置 RIP 路由篩選器。
routing ipx rip set global 配置全局 IPX 的 RIP 設(shè)置。
routing ipx rip set interface 在指定接口上配置 IPX 的 RIP 設(shè)置。
routing ipx sap add/set filter 添加或配置 SAP 服務(wù)篩選器。
routing ipx sap set global 配置全局 IPX 的 SAP 設(shè)置。
routing ipx sap set interface 在指定接口上配置 IPX 的 SAP 設(shè)置。
routing ipx netbios add nbname 將靜態(tài) NETBIOS 名稱添加到 IPX NetBIOS 名稱表中。
routing ipx netbios set interface 在指定接口上配置基于 IPX 的 NetBIOS 設(shè)置。
route 英式說(shuō)明幫助
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*.
The PRINT command will show both IPv4 and IPv6 routes, but the ADD, DELETE,
and CHANGE commands work only for IPv4 routes. For IPv6 routes, use
the 'interface ipv6' context in netsh.exe.
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
您可能感興趣的文章:
- windows XP 的命令大全
- 不錯(cuò)的windows server 2003 工具資源命令集
- Windows 2000下用DOS命令刪除文件夾
- Windows網(wǎng)絡(luò)命令行程序參數(shù)說(shuō)明
- Windows下用命令行修改IP地址的方法詳解(附批處理文件)
- windows批處理命令教程
- dos下通過(guò)wmic命令查看硬盤和內(nèi)存/CPU信息(windows自帶命令查看硬件信息)
- Windows WMIC命令使用詳解(附實(shí)例)
- Windows運(yùn)行bat批處理文件時(shí)隱藏cmd命令提示符窗口的方法
- Windows控制面板命令大全
相關(guān)文章
分析對(duì)比華為虛擬化CSS與H3C虛擬化IRF2技術(shù)
這篇文章主要介紹了了華為虛擬化CSS與H3C虛擬化IRF2技術(shù),并對(duì)這兩種技術(shù)作了詳細(xì)的對(duì)比,有需要的朋友可以借鑒參考下,希望可以幫助廣大讀者對(duì)虛擬化集群管理有更深一步的了解2021-08-08華為各種型號(hào)交換機(jī)端口鏡像配置方法總結(jié)
華為各種型號(hào)交換機(jī)端口鏡像配置方法總結(jié)...2007-04-04關(guān)于華為設(shè)備產(chǎn)品型號(hào)解釋
關(guān)于華為設(shè)備產(chǎn)品型號(hào)解釋...2007-04-04