Windows路由表配置:雙網卡同時上內外網

來源:互聯網
上載者:User

標籤:

原文來自:http://www.cnblogs.com/lightnear/archive/2013/02/03/2890835.html

一、windows 路由表解釋

route print -4
===========================================================================Interface List 19...78 dd 08 a4 40 f4 ......Bluetooth Device (Personal Area Network)11...00 27 10 5b 26 fc ......Intel(R) Centrino(R) Advanced-N 6200 AGN 13...f0 de f1 08 58 f4 ......Intel(R) 82577LM Gigabit Network Connection 15...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 16...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8  1...........................Software Loopback Interface 1 23...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 12...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface 21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 17...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4 20...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #5 22...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #6===========================================================================IPv4 Route Table===========================================================================Active Routes:Network Destination        Netmask          Gateway       Interface  Metric          0.0.0.0          0.0.0.0      192.168.0.1     192.168.1.12     26       10.108.0.0      255.255.0.0      10.108.58.1     10.108.58.18     21      10.108.58.0    255.255.255.0         On-link      10.108.58.18    276     10.108.58.18  255.255.255.255         On-link      10.108.58.18    276    10.108.58.255  255.255.255.255         On-link      10.108.58.18    276        127.0.0.0        255.0.0.0         On-link         127.0.0.1    306        127.0.0.1  255.255.255.255         On-link         127.0.0.1    306  127.255.255.255  255.255.255.255         On-link         127.0.0.1    306       172.16.0.0      255.255.0.0      10.108.58.1     10.108.58.18     21      192.168.0.0    255.255.252.0         On-link      192.168.1.12    281     192.168.1.12  255.255.255.255         On-link      192.168.1.12    281    192.168.3.255  255.255.255.255         On-link      192.168.1.12    281     192.168.10.0    255.255.255.0         On-link      192.168.10.1    276     192.168.10.1  255.255.255.255         On-link      192.168.10.1    276   192.168.10.255  255.255.255.255         On-link      192.168.10.1    276    192.168.159.0    255.255.255.0         On-link     192.168.159.1    276    192.168.159.1  255.255.255.255         On-link     192.168.159.1    276  192.168.159.255  255.255.255.255         On-link     192.168.159.1    276        224.0.0.0        240.0.0.0         On-link         127.0.0.1    306        224.0.0.0        240.0.0.0         On-link      10.108.58.18    276        224.0.0.0        240.0.0.0         On-link     192.168.159.1    276        224.0.0.0        240.0.0.0         On-link      192.168.10.1    276        224.0.0.0        240.0.0.0         On-link      192.168.1.12    281  255.255.255.255  255.255.255.255         On-link         127.0.0.1    306  255.255.255.255  255.255.255.255         On-link      10.108.58.18    276  255.255.255.255  255.255.255.255         On-link     192.168.159.1    276  255.255.255.255  255.255.255.255         On-link      192.168.10.1    276  255.255.255.255  255.255.255.255         On-link      192.168.1.12    281===========================================================================Persistent Routes:  Network Address          Netmask  Gateway Address  Metric      172.21.10.0    255.255.255.0    172.16.56.190       1       10.108.0.0      255.255.0.0      10.108.58.1       1       172.16.0.0      255.255.0.0      10.108.58.1       1===========================================================================

Interface List: 網路卡列表

Active Routes: 活動路由

Network Destination: 目的網段

Netmask: 子網路遮罩,與目的網段共同定義了此條路由適用的網路地址

Gateway: 網關,又稱下一跳路由器,在發送IP資料包時,網關定義了針對特定的網路目的地址,資料包發送到的下一跳伺服器

Interface: 介面,介面定義了針對特定的網路目的地址,本機電腦用於發送資料包的網路介面

Metric: 跳數,跳數用於指出路由的成本,通常情況下代表到達目標地址所需要經過的跳躍數量,一個跳數代表經過一個路由器。跳數越低,代表路由成本越低,優先順序越高

Persistent Routes: 手動設定靜態路由

 

二、windows 路由命令

Manipulates network routing tables.ROUTE [-f] [-p] [-4|-6] 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.  -4           Force using IPv4.  -6           Force using IPv6.  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 databasefile NETWORKS. The symbolic names for gateway are looked up in the host namedatabase 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 onlymatching destination routes are printed. The ‘*‘ matches any string,and ‘?‘ matches any one char. Examples: 157.*.1, 157.*, 127.*, *224*.Pattern match is only allowed in PRINT command.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 PRINT -4    > route PRINT -6    > route PRINT 157*          .... Only prints those matching 157*    > 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 ADD 3ffe::/32 3ffe::1    > 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 DELETE 157.0.0.0    > route DELETE 3ffe::/32

route print: 列印當前的路由表

route delete:刪除一條路由

route add: 增加一條路由, 如果最後加上 –p 選項,表示永久增加靜態路由,重啟後不會失效

route change: 更改一條路由

三、雙網卡配置實便

 

1. 網路環境:

有線:可串連公司內網,不能串連Internet

無線:可串連Internet,不能串連公司內網  預設閘道為 192.168.0.1

我們的目的就是同時串連這兩個網路,並自動選擇路由實現內外網都可以訪問。

 

2. 配置

:刪除預設設定route delete 0.0.0.0:外網路由,全走無線route add 0.0.0.0 mask 0.0.0.0 192.168.0.1 –p:公司內網全部在10.108.*.*網段,增加此路由route add 10.108.0.0 mask 255.255.0.0 10.108.58.1 -p

就是這麼簡單,結果如下(還有另外幾個路由配置是做其它用途的)

PING下試試

Windows路由表配置:雙網卡同時上內外網

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.