1. 程式人生 > >Windows路由表配置:雙網絡卡同時上公司內外網

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

一、windows 路由表解釋

route print -4

Interface List: 網路卡列表
Active Routes: 活動路由
Network Destination: 目的網段
Netmask: 子網掩碼,與目的網段共同定義了此條路由適用的網路地址
Gateway: 閘道器,又稱下一跳路由器,在傳送IP資料包時,閘道器定義了針對特定的網路目的地址,資料包傳送到的下一跳伺服器
Interface: 介面,介面定義了針對特定的網路目的地址,本地計算機用於傳送資料包的網路介面
Metric: 跳數,跳數用於指出路由的成本,通常情況下代表到達目標地址所需要經過的跳躍數量,一個跳數代表經過一個路由器。跳數越低,代表路由成本越低,優先順序越高
Persistent Routes: 手動配置靜態路由

二、windows 路由命令

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.

route print: 列印當前的路由表
route delete:刪除一條路由
route add: 增加一條路由, 如果最後加上 –p 選項,表示永久增加靜態路由,重啟後不會失效
route change: 更改一條路由

三、雙網絡卡配置實便

1. 網路環境:

外網閘道器:192.168.1.1

內網閘道器:10.10.20.1

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

2. 配置

:刪除預設設定

route delete 0.0.0.0

:外網路由
route  add  0.0.0.0  mask  0.0.0.0  192.168.1.1  -p

:公司內網全部在10.108.*.*網段,增加此路由
route  add  10.108.0.0  mask  255.255.0.0  10.10.20.1  -p

3.驗證

ping www.baidu.com

ping 10.108.0.11