Nic

伺服器不通過直接連接的網卡進行通信

  • September 1, 2016

我有 2 台伺服器(Windows Server 2012 R2),每台都有(超過)2 個網卡。我希望兩台伺服器都將 1 個網卡用於“Internet”,並使用 1 個網卡直接與另一台伺服器通信。(還有第三台伺服器,但我現在不詳細介紹。)

伺服器 1 有公共 IP 63.148.179.243(介面 14)和本地 IP 192.168.211.13(介面 15)

伺服器 2 有公共 IP 63.148.179.244 和本地 IP 192.168.211.15

(介面 15 直接連接到伺服器 2)

我希望伺服器直接通信,即使我會通過它們的公共 IP 定址它們。我假設我必須在伺服器 1 上添加這樣的路由:route -p add 63.148.179.244/32 192.168.211.13 metric 10 if 15

但即使在這樣做之後,如果我在伺服器 1 上打開瀏覽器並從http://63.148.179.244/hugeFile.txt下載一個大文件,我看到連接到 Internet 的網卡正在滿載,而且下載速度遠低於我的預期。

我也嘗試了略有不同,沒有更好的結果,使用:route -p add 63.148.179.244/32 192.168.211.15 metric 10 if 15route -p add 63.148.179.244/32 192.168.211.13 metric 10 if 14

添加路由時,它看起來像這樣:

C:\Windows\system32>route -p add 63.148.179.244/32 192.168.211.13 metric 10 if 15
OK!

C:\Windows\system32>route print
===========================================================================
Interface List
20...02 c5 d5 76 49 2c ......Microsoft Failover Cluster Virtual Adapter
13...94 57 a5 57 86 6d ......HP Ethernet 1Gb 4-port 331i Adapter #2
15...94 57 a5 57 86 6e ......HP Ethernet 1Gb 4-port 331i Adapter #3
14...94 57 a5 57 86 6c ......HP Ethernet 1Gb 4-port 331i Adapter
 1...........................Software Loopback Interface 1
16...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2
17...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter
18...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #3
19...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #4
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
         0.0.0.0          0.0.0.0   63.148.179.241   63.148.179.243    276
  63.148.179.240  255.255.255.240         On-link    63.148.179.243    276
  63.148.179.242  255.255.255.255         On-link    192.168.211.12     20
  63.148.179.243  255.255.255.255         On-link    63.148.179.243    276
  63.148.179.244  255.255.255.255         On-link    192.168.211.13     20
  63.148.179.251  255.255.255.255         On-link    63.148.179.243    276
  63.148.179.252  255.255.255.255         On-link    63.148.179.243    276
  63.148.179.255  255.255.255.255         On-link    63.148.179.243    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
   192.168.211.0    255.255.255.0         On-link    192.168.211.12    266
   192.168.211.0    255.255.255.0         On-link    192.168.211.13    266
  192.168.211.12  255.255.255.255         On-link    192.168.211.12    266
  192.168.211.13  255.255.255.255         On-link    192.168.211.13    266
 192.168.211.255  255.255.255.255         On-link    192.168.211.12    266
 192.168.211.255  255.255.255.255         On-link    192.168.211.13    266
       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    63.148.179.243    276
       224.0.0.0        240.0.0.0         On-link    192.168.211.12    266
       224.0.0.0        240.0.0.0         On-link    192.168.211.13    266
 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    63.148.179.243    276
 255.255.255.255  255.255.255.255         On-link    192.168.211.12    266
 255.255.255.255  255.255.255.255         On-link    192.168.211.13    266
===========================================================================
Persistent Routes:
 Network Address          Netmask  Gateway Address  Metric
         0.0.0.0          0.0.0.0   63.148.179.241  Default
  63.148.179.242  255.255.255.255   192.168.211.12      10
  63.148.179.244  255.255.255.255   192.168.211.13      10
===========================================================================

IPv6 Route Table
===========================================================================
Active Routes:
If Metric Network Destination      Gateway
17   1026 ::/0                     2002:c058:6301::1
 1    306 ::1/128                  On-link
17   1025 2002::/16                On-link
17    281 2002:3e94:b3f3::3e94:b3f3/128
                                   On-link
17    281 2002:3e94:b3fb::3e94:b3fb/128
                                   On-link
17    281 2002:3e94:b3fc::3e94:b3fc/128
                                   On-link
14    276 fe80::/64                On-link
13    266 fe80::/64                On-link
15    266 fe80::/64                On-link
15    266 fe80::196e:792:9b88:76d9/128
                                   On-link
13    266 fe80::64f0:273b:28a6:72b9/128
                                   On-link
14    276 fe80::f94d:9dfa:c394:9f82/128
                                   On-link
 1    306 ff00::/8                 On-link
14    276 ff00::/8                 On-link
13    266 ff00::/8                 On-link
15    266 ff00::/8                 On-link
===========================================================================
Persistent Routes:
 None

C:\Windows\system32>

請指教。

據我所知,接收介面將忽略與其 IP 不匹配的流量,即使另一個介面確實有匹配的 IP。您期望伺服器像路由器一樣工作,但如果不啟用路由和遠端訪問(或網路共享),Windows 不會將數據包從一個介面路由到另一個介面。我不確定啟用 RRAS 是否會解決此問題,但如果確實如此,那麼您可能必須啟用一堆防火牆規則來防止任何潛在的不需要的路由。

引用自:https://serverfault.com/questions/800287