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

我们的目的就是同时连接这两个网络,并自动选择路由实现内外网都可以访问。

  1. 配置:
    :删除默认设置
    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