windows – 使用两个网络适配器为特定网络适配器设置静态路由

前端之家收集整理的这篇文章主要介绍了windows – 使用两个网络适配器为特定网络适配器设置静态路由前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我有一个带有2个虚拟网络适配器的虚拟 Windows Server 2008 r2,一个是域的一部分,另一个不是.当我ping到属于域的特定PC时,它通过第二个网络适配器(不在域中的那个)连接到它,我尝试用静态路由更改它:
ROUTE ADD -P <target PC's IP> MASK <Subnet mask from ipconfig> <Default Gateway of the adapter in the domain> if <tried it with all possible interfaces>

不幸的是,这不起作用,所以我很乐意得到如何制作这种静态路由的帮助,以便我的服务器通过域中的网络适配器连接到域中的PC?

路由打印输出和ipconfig:

C:\Users\user>route print

========================================

Interface List

 18...00 15 5d 80 0f 47 ......Microsoft Virtual Machine Bus Network Adapter #2

 11...00 15 5d 80 0f 1a ......Microsoft Virtual Machine Bus Network Adapter

  1...........................Software Loopback Interface 1

 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter

 21...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2

IPv4 Route Table

=========================================================================== 

Active Routes: Network Destination        Netmask          Gateway    Interface  Metric

          0.0.0.0          0.0.0.0  192.168.128.254   192.168.128.13      5

          0.0.0.0          0.0.0.0    192.168.137.1   192.168.137.15      5

        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

    192.168.128.0    255.255.255.0         On-link    192.168.128.13    261

   192.168.128.13  255.255.255.255         On-link    192.168.128.13    261

  192.168.128.255  255.255.255.255         On-link    192.168.128.13    261

    192.168.137.0    255.255.255.0         On-link    192.168.137.15    261

   192.168.137.15  255.255.255.255         On-link    192.168.137.15    261

  192.168.137.255  255.255.255.255         On-link    192.168.137.15    261

        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    192.168.128.13    261

        224.0.0.0        240.0.0.0         On-link    192.168.137.15    261

  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    192.168.128.13    261

  255.255.255.255  255.255.255.255         On-link    192.168.137.15    261

=========================================================================== 
Persistent Routes:   

Network Address       Netmask  Gateway Address Metric

192.168.128.8       255.255.255.0  192.168.128.254    1

===========================================================================

IPv6 Route Table

=========================================================================== 

Active Routes:

 If Metric Network Destination      Gateway

 18    261 ::/0                     fe80::f427:d7d8:4ec2:fd5

  1    306 ::1/128                  On-link

 11    261 fe80::/64                On-link

 18    261 fe80::/64                On-link

 11    261 fe80::8ce7:a7a5:d7c0:faf1/128 On-link

 18    261 fe80::a8c7:ee26:b1bb:fd77/128 On-link

  1    306 ff00::/8                 On-link

 11    261 ff00::/8                 On-link

 18    261 ff00::/8                 On-link

===========================================================================
Persistent Routes:   None

C:\Users\user>ipconfig

Windows IP Configuration

Ethernet adapter Local Area Connection 2:

   Connection-specific DNS Suffix  . :

   Link-local IPv6 Address . . . . . : fe80::a8c7:ee26:b1bb:fd77%18

   IPv4 Address. . . . . . . . . . . : 192.168.137.15

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . : fe80::f427:d7d8:4ec2:fd5%18

                                       192.168.137.1

Ethernet adapter Local Area Connection:

   Connection-specific DNS Suffix  . : domainName.com

   Link-local IPv6 Address . . . . . : fe80::8ce7:a7a5:d7c0:faf1%11

   IPv4 Address. . . . . . . . . . . : 192.168.128.13    

   Subnet Mask . . . . . . . . . . . : 255.255.255.0

   Default Gateway . . . . . . . . . : 192.168.128.254

Tunnel adapter isatap.domainName.com:

   Media State . . . . . . . . . . . : Media disconnected

   Connection-specific DNS Suffix  . : domainName.com

Tunnel adapter isatap.{5364A7C9-95AE-4753-98A3-8D60A49D43D5}:

   Media State . . . . . . . . . . . : Media disconnected   

   Connection-specific DNS Suffix  . :
问题的一部分是你有2个DEFAULT GATEWAY,它违反了DEFAULT GATEWAY的含义.仅将默认网关放在一个接口上.然后使用静态路由,通过其他接口指示您想要的流量.

例如,LAN1 192.168.123.13掩码255.255.255.0和GW 192.168.128.254.这将使所有流量达到192.168.123.x,任何其他网络的任何内容都将通过网关进行定向.

但是然后添加LAN2 192.168.137.15掩码255.255.255.0没有任何默认网关.这将自动创建192.168.137.x将通过此接口而不是默认网关的路由条目.现在,如果您希望其他流量通过该接口,您可以创建一个静态路由,如:

ROUTE ADD -P 192.168.33.0 MASK 255.255.255.0 192.168.137.1

这将通过LAN2将流量发送到192.168.33.x,因为192.168.137.1与LAN2接口位于同一网络中.

原文链接:https://www.f2er.com/windows/368937.html

猜你在找的Windows相关文章