手动路由在 Windows 10 中不起作用

手动路由在 Windows 10 中不起作用

我正在努力做一个静态路由在 Windows 10 和特定 PC 上工作:它似乎没有完成其工作。

这是之前的路线表:

C:\WINDOWS\system32>route print
===========================================================================
Interface List
 27...84 a9 XX XX XX XX ......Realtek PCi GBE Family Controller #2
 26...04 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #3
 11...06 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #4
 12...04 d3 XX XX XX XX ......Intel(R) Dual Band Wireless-AC 7265 #2
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.7    105
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
      192.168.1.0    255.255.255.0         On-link       192.168.1.7    301
      192.168.1.7  255.255.255.255         On-link       192.168.1.7    301
    192.168.1.255  255.255.255.255         On-link       192.168.1.7    301
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link       192.168.1.7    301
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link       192.168.1.7    301
===========================================================================
 Persistent Routes:
   None

如你所见,Wi-Fi 卡(具有自动度量)被分配了一个 IP192.168.1.7通过路由器 192.168.1.1;我希望所有流量都192.168.0.0/24转发至 192.168.1.253。

因此我添加了(临时)路线:

C:\WINDOWS\system32>route ADD 192.168.0.0 MASK 255.255.255.0 192.168.1.253
 OK

然后我检查路线打印再次尝试,似乎没问题:

C:\WINDOWS\system32>route print
===========================================================================
Interface List
 27...84 a9 XX XX XX XX ......Realtek PCi GBE Family Controller #2
 26...04 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #3
 11...06 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #4
 12...04 d3 XX XX XX XX ......Intel(R) Dual Band Wireless-AC 7265 #2
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.1.1      192.168.1.7    105
        127.0.0.0        255.0.0.0         On-link         127.0.0.1    331
        127.0.0.1  255.255.255.255         On-link         127.0.0.1    331
  127.255.255.255  255.255.255.255         On-link         127.0.0.1    331
      192.168.0.0    255.255.255.0    192.168.1.253      192.168.1.7     46
      192.168.1.0    255.255.255.0         On-link       192.168.1.7    301
      192.168.1.7  255.255.255.255         On-link       192.168.1.7    301
    192.168.1.255  255.255.255.255         On-link       192.168.1.7    301
        224.0.0.0        240.0.0.0         On-link         127.0.0.1    331
        224.0.0.0        240.0.0.0         On-link       192.168.1.7    301
  255.255.255.255  255.255.255.255         On-link         127.0.0.1    331
  255.255.255.255  255.255.255.255         On-link       192.168.1.7    301
===========================================================================
 Persistent Routes:
   None

我还可以通过以下方式查看路线:

C:\WINDOWS\system32>route print 192.168.0.*
===========================================================================
Interface List
 27...84 a9 XX XX XX XX ......Realtek PCi GBE Family Controller #2
 26...04 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #3
 11...06 d3 XX XX XX XX ......Microsoft Wi-Fi Direct Virtual Adapter #4
 12...04 d3 XX XX XX XX ......Intel(R) Dual Band Wireless-AC 7265 #2
  1...........................Software Loopback Interface 1
===========================================================================

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
      192.168.0.0    255.255.255.0    192.168.1.253      192.168.1.7     46
===========================================================================
 Persistent Routes:
   None

但是当我 ping 的时候,192.168.0.0/24 IP 都没有给我任何回复。

C:\WINDOWS\system32>ping 192.168.0.1

Pinging 192.168.0.1 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 192.168.0.1:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

C:\WINDOWS\system32>ping 192.168.1.253

Pinging 192.168.1.253 with 32 bytes of data:
Reply from 192.168.1.253: bytes=32 time=117ms TTL=128
Reply from 192.168.1.253: bytes=32 time=4ms TTL=128
Reply from 192.168.1.253: bytes=32 time=4ms TTL=128
^C

Ping statistics for 192.168.1.253:
    Packets: Sent = 3, Received = 3, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 4ms, Maximum = 117ms, Average = 41ms

C:\WINDOWS\system32>tracert 192.168.0.1

  1     *           *           *   Request timeout.
  2     *           *           *   Request timeout.
  3     *           *           *   Request timeout.
  4     *           *           *   Request timeout.
  5 ^C

我确信 192.168.1.253 可以正确转发数据包,因为我使用了另一个路由器 + 另一台 PC,并使用了相同的路由命令,并且它可以正常工作,但我需要让这个路由器 (192.168.1.1) 和这台 PC (192.168.1.7) 正常工作。此外,我无法在路由器本身 (192.168.1.1) 上添加静态路由,因为它不支持此功能。

编辑 1:192.168.0.1 路由器上当然有一个静态路由,它将所有 192.168.1.0/24 流量转发到 IP 192.168.0.112,这是同一设备上具有 192.168.1.253 的另一个接口。在此设备上,我可以 ping 两个网络中的每个其他设备。

编辑2:我也尝试禁用 PC(192.168.1.7)上的防火墙,但令人难以置信的是它仍然不起作用。

相关内容