Windows路由表配置:双网卡同时上内外网

原文来自: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 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*.

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下试试

时间: 2024-07-28 17:55:47

Windows路由表配置:双网卡同时上内外网的相关文章

有关双网卡同时上内外网的一点想法

因为工作原因,我是要同时用内外网的,以前是只有笔记本自带网卡,要进内外网就要不停的切换,很麻烦 最近实在忍不住了,又去某宝买了一张网卡前几天到的货,按网上的教程写如下路由表 route delelte 0.0.0.0 route add 172.16.152.0 mask 255.255.0.0 172.16.63.50 -p route add 0.0.0.0 mask 255.255.255.0 192.168.1.1 -p route add 0.0.0.0 mask 0.0.0.0 19

双网卡同时上内外网

查看路由表命令route print 第一步:删除默认路由 route delete 0.0.0.0 注:删除所有0.0.0.0的路由,这个是默认访问外网的路由 第二步:添加静态路由 (假设内网网段为192.168.10.x,网关为192.168.10.1: 外网网段为192.168.20.x,网关为192.168.20.1) 先配置内网静态路由: route add 192.168.10.0 mask 255.255.255.0 192.168.10.1 -p 注:它表示访问192.168.1

双网卡同时访问内外网

为了方便自己在一台机器上同时访问内网和外网,自己对系统路由作了一点点更改,既方便了自己,又学习到了相关的路由知识. 网络环境(我办公室真实的网络环境): 1.一台主机: 2.两张网卡: 3.外网通过SOHO路由器上ADSL,网关为192.168.0.1,本机外网IP为192.168.0.101: 4.内网全网网络地址为10.0.0.0 掩码为255.0.0.0 ,我所在区域的子网络为10.*.*.0,网关为:10.*.*.*,本机IP为10.*.*.* . 要解决的问题: 两张网卡要同时开启,并

双网卡网段相同内外网访问

部门公司使用的双网卡连接,但是内部网段都是相同的,举例: 内网网卡ip:192.168.1.0/24 内部服务器存放的网段 内网网关:192.168.1.254 其中erp服务器192.168.1.253 外网网卡ip:192.168.1.0/24 访问internet的网段   外网网关:192.168.1.1 这种情况的出现会导致内部1的网段的服务器访问出现问题,如果使用route add 命令后还是不能访问内部网段的服务器,因为此两端的ip地址重复了,使用route print命令可以看到

(转)如何设置双网卡电脑同时上内外网

转:https://jingyan.baidu.com/article/cbf0e500ac8b232eaa289339.html 一台电脑可以同时上内外网,省去了办公的许多烦恼.每台电脑都有自己的路由表,可以通过开始-运行-输cmd-输入route print ,就可查询到自身的路由信息.计算机上的路由表可以手动进行修改(添加或删除),这样就可以通过一系列的设置来满足同时上内外网. 工具/原料 一台双网卡电脑.网线已连接好内外网 方法/步骤 1 第一步: 先要设置两个网卡的IP地址,假设外网的

Windows Server 2012 R2配置双网卡绑定

生产环境的服务器硬件设备:2块网卡,分别接入2根网线 需要实现的效果:无论拔掉哪1根网线,都不会中断网络,实现网络的负载均衡,保证网络的持续可用. 前提条件:与这2块网卡相连的交换机必须做特殊配置(即这2个端口应该采取聚合方式),因为绑定的这2块网卡是使用同一个MAC地址. 1.在VMware Workstation中新增1块网卡,并查看网卡设备: 2.将2块网卡的IP地址都设置为"自动获得IP地址": Ethernet0: Ethernet1: 3.设置NIC组合: 点击NIC组合后

windows server 2012R2 双网卡绑定

windows server 2012R2 双网卡绑定 在目前的工作当中,对于双网卡绑定应用还是比较广泛的.双网卡绑定的好处在于,它可以实现网络的容错(主主模式.主备模式),还可以实现带宽的绑定.下面我们通过实验来实现双网卡的绑定. 实验准备:准备两个虚拟机,server01用来做目标服务器,需要两块网卡,并清除网卡上的所有配置.server02做测试服务器. 步骤一:准备至少两块网卡 首先在server01上添加一块网卡.,右键单击server01,选择配置,点击添加 选择网络适配器,下一步

vmvare虚拟机配置双网卡

最近想在windows上pc端安装一个VMware来准备几个linux系统测试环境玩玩 在配置网络上遇到点小问题,特在此处记录下 虚拟网络设置 首先点击VMware--->编辑---->虚拟网络设置 配置过程如下: 在clone好的虚拟机器上添加网络适配器 配置双网卡: 新clone的虚拟机里,配置好网卡,重启报错如下: 解决办法:cat /etc/udev/rules.d/70-persistent-net.rules 原因clone虚拟机器时,clone后的虚拟机保留了源虚拟机网卡的mac

Ubuntu 配置双网卡绑定,实现负载均衡

Ubuntu 配置双网卡绑定,实现负载均衡 1.Bond的工作模式 Linux bonding驱动提供了一个把多个网络接口设备捆绑为单个的网络接口设置来使用,用于网络负载均衡及网络冗余. bonding一共有7种工作模式(mode): 1).bond=0,(balance-rr) Round-robin policy: (平衡轮询策略):传输数据包顺序是依次传输,直到最后一个传输完毕,此模式提供负载平衡和容错能力. 2).bond=1,(active-backup) Active-backup