Windows

從 Windows 上的特定網路適配器 Ping

  • May 17, 2019

嘿,我一直在對帶有 2 個 NIC 的伺服器和帶有有線和無線網卡的筆記型電腦上的網路問題進行故障排除。如何強制從特定適配器發送 PING 和 TELNET?我知道這是windows的問題。關閉其中一個適配器不是一種選擇,我總是通過其中一個適配器連接。必須有一些命令行選項來選擇一個適配器而不是另一個。

謝謝

您可以設置靜態路由:

route add (destination subnet) MASK (destination subnet mask) (gateway) IF (interface)

有關詳細資訊,請查看Microsoft 的文件route

可能更簡單的是使用 -S 開關,它可以讓您指定源 IP 地址(請參閱 ping /? 了解更多資訊)。

您可以做的另一件事是更改綁定順序,這符合您的“選擇一個適配器而不是另一個適配器的選項”。儘管它因 Windows 作業系統而異,但與此範例的位置相似:對於 Windows 7,您右鍵點擊網路,然後點擊屬性。然後點擊“更改適配器設置”。然後點擊菜單高級>高級設置並將您想要優先的連接移動到頂部。

從 Windows 7(版本 6.1 Build 7601:Service Pack 1)ping /?

Usage: ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS]
       [-r count] [-s count] [[-j host-list] | [-k host-list]]
       [-w timeout] [-R] [-S srcaddr] [-4] [-6] target_name


Options:
-t             Ping the specified host until stopped.
              To see statistics and continue - type Control-Break;
              To stop - type Control-C.
-a             Resolve addresses to hostnames.
-n count       Number of echo requests to send.
-l size        Send buffer size.
-f             Set Don't Fragment flag in packet (IPv4-only).
-i TTL         Time To Live.
-v TOS         Type Of Service (IPv4-only. This setting has been deprecated
              and has no effect on the type of service field in the IP Header).
-r count       Record route for count hops (IPv4-only).
-s count       Timestamp for count hops (IPv4-only).
-j host-list   Loose source route along host-list (IPv4-only).
-k host-list   Strict source route along host-list (IPv4-only).
-w timeout     Timeout in milliseconds to wait for each reply.
-R             Use routing header to test reverse route also (IPv6-only).
-S srcaddr     Source address to use.
-4             Force using IPv4.
-6             Force using IPv6.

Microsoft TechNet Ping 文件指出它只能用於 IPV6(不正確) 適用於:Windows Server 2003、Windows Vista、Windows XP、Windows Server 2008、Windows 7、Windows Server 2003 R2、Windows Server 2008 R2、Windows Server 2000 , 視窗伺服器 2012, 視窗 8

Microsoft TechNet - 使用 Ping 命令(Windows 7 和 Server 2008 R2)(也缺少 -S srcaddr)

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