2011-01-11 08:42:02
如双网卡多是一个内网一个外网:
ip
网关
子网掩码
内网:192.168.200.27
192.168.200.100
255.255.255.0
外网:192.168.1.113
192.168.1.1
255.255.255.0
内网:192.168.200.27
外网:192.168.1.113
怎样同时上内网和外网
先打开cmd下输入 route print 查看路由表
Active Routes:
Network Destination
Netmask
Gateway
Interface Metric
可以看到网关(主要我们设置也就设置网关就可以的)
先用命令删除网关
route delete 0.0.0.0
然后在新建网关
route add 0.0.0.0 mask 0.0.0.0 192.168.1.1
就可以直接上外网了。
route add 192.168.0.0 mask 255.0.0.0 192.168.200.100
就可以同时上网有可以上内部网络了的
这个设置重启后会被还原
route add -p 添加静态路由
加-p就可以永久的添加使用
有一台机器,双网卡,接内外网
一网卡地址分配为:32.125.50.20 255.255.255.0 32.125.50.251 外网
另网卡地址分配为:192.168.1.20 255.255.255.0 192.168.1.250 内网
两个网络物理隔绝。
现请教,如何配置route表,才能同时上内外网,还有关于默认网关,该保留哪一个!
谢谢!
2个网卡2个网络环境 只能有一个网关
1.首先把外网设置为默认网关
一步一步照着做就OK:
网络连接→本地连接(外网网卡)属性→常规→Internet协议→属性→点高级→IP设置里面这时候找到中间默认网关 点编辑→自动跃点对勾去掉→填写为1→确定→确定→确定。。。
2.添加内网路由走内网网卡
开始→运行→输入CMD回车(好像太啰嗦了。。。)
输入 route add 192.168.1.0 mask 255.255.255.0 192.168.1.250 回车
指定了将192.168.1.0 这个网段的通讯全部设置为从192.168.1.250 内网线路走。这时候可以临时使用了 想永久使用。
输入 route -p add 192.168.1.0mask 255.255.255.0 192.168.1.250回车
以上根据内网网关192.168.1.250/24做的回帖 如果有变动自行更改吧
C:\Documents and Settings\Administrator>netstat -r
IPv4 Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x20003 ...00 24 81 b2 44 10 ...... HP NC105i PCIe Gigabit Server Adapter
0x30004 ...00 18 71 ec bd 88 ...... HP NC110T PCIe Gigabit Server Adapter
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
Default Gateway:
20.120.104.193
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>
====================================================上表是两个网卡都设置了网关的
下表是已经取消了192.168.0.4的网关的.================================================
C:\Documents and Settings\Administrator>route print
IPv4 Route Table
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x20003 ...00 24 81 b2 44 10 ...... HP NC105i PCIe Gigabit Server Adapter
0x30004 ...00 18 71 ec bd 88 ...... HP NC110T PCIe Gigabit Server Adapter
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
Default Gateway:
20.120.104.193
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>
设置:
网卡1:
20.120.104.197
255.255.255.192
20.120.104.193
网卡2:
192.168.0.4
255.255.255
不用设置网关
CMD:
route add 192.168.0.0 mask 255.255.0.0 192.168.0.254 /p
因为内网的其他VLAN需要通过192.168.0.4来访问20.120.104.193的服务器.
如果两个网卡都添加网关,生成的默认路由会引起冲突,为了正常可以两个网卡都可以通信,
只能在本机添加一条静态路由。
上面的命令意思就是:
外网20.120.104.193都可以通过本机的静态路由中的192.168.0.254网关访问(被访问)192.168.0.0/16的机器,
这样,192.168.0.4可以作为中转服务器使用,并不影响访问内外网。
-p参数是写入注册表,以防机器重启掉失路由条目。
C:\Documents and Settings\Administrator>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0d 60 2d 99 02 ...... Intel(R) PRO/100 VE Network Connection - 数据包
计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0d 60 2d 99 02 ...... Intel(R) PRO/100 VE Network Connection - 数据包
计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0d 60 2d 99 02 ...... Intel(R) PRO/100 VE Network Connection - 数据包
计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 0d 60 2d 99 02 ...... Intel(R) PRO/100 VE Network Connection - 数据包
计划程序微型端口
===========================================================================
===========================================================================
Active Routes:
Network Destination
Netmask
Gateway
Interface
Metric
Default Gateway:
19.123.186.1
===========================================================================
Persistent Routes:
C:\Documents and Settings\Administrator>