由于路由无效,某些 IP 地址无法访问

由于路由无效,某些 IP 地址无法访问

我想连接到远程机器。问题是我可以连接到除一台之外的所有机器。经过一番研究,我发现问题出在路由上。以下是示例:

PS C:\Users\Alex> tracert 172.17.56.66

Tracing route to 172.17.56.66 over a maximum of 30 hops

  1    31 ms     9 ms    12 ms  10.19.64.1
  2     9 ms    14 ms     8 ms  172.17.56.66

Trace complete.
PS C:\Users\Alex> tracert 172.17.56.68

Tracing route to 172.17.56.68 over a maximum of 30 hops

  1    13 ms     7 ms     7 ms  10.19.64.1
  2    10 ms     5 ms     4 ms  172.17.56.68

Trace complete.
PS C:\Users\Alex> tracert 172.17.56.70

Tracing route to 172.17.56.70 over a maximum of 30 hops

  1    <1 ms    <1 ms    <1 ms  192.168.0.1
  2     8 ms    41 ms     7 ms  188.170.9.10
  3    96 ms     1 ms     1 ms  192.168.1.1
  4     1 ms    <1 ms    <1 ms  10.90.40.41
  5     1 ms     1 ms     1 ms  10.90.40.34
  6     1 ms     1 ms     1 ms  10.90.40.32
  7     3 ms     8 ms     2 ms  10.90.35.80
  8     *        *     10.90.35.78  reports: Destination net unreachable.

Trace complete.

我不知道为什么它以不同的方式处理这个 IP。这是我的route print

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

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0      192.168.0.1    192.168.0.239     35
     10.19.84.212  255.255.255.252         On-link      10.19.84.214    311
     10.19.84.214  255.255.255.255         On-link      10.19.84.214    311
     10.19.84.215  255.255.255.255         On-link      10.19.84.214    311
        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
     172.17.56.65  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.66  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.67  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.68  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.69  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.72  255.255.255.255     10.19.84.213     10.19.84.214     55
     172.17.56.73  255.255.255.255     10.19.84.213     10.19.84.214     55
      192.168.0.0    255.255.255.0         On-link     192.168.0.239    291
    192.168.0.239  255.255.255.255         On-link     192.168.0.239    291
    192.168.0.255  255.255.255.255         On-link     192.168.0.239    291
        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      10.19.84.214    311
        224.0.0.0        240.0.0.0         On-link     192.168.0.239    291
  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      10.19.84.214    311
  255.255.255.255  255.255.255.255         On-link     192.168.0.239    291
===========================================================================
Persistent Routes:
  None

因此,在我静态添加它之后(基于 66 和 68 网关)

route ADD -p 172.17.56.70 MASK 255.255.255.255 10.19.84.213

成功了。但是为什么在其他情况下网关会自动检测,而在这个情况下我却要对其进行硬编码呢?

答案1

您的默认网关是 192.168.0.1。因此,如果没有静态路由,流量将通过默认网关,直接连接的网络除外。在上面的 172.17.56.70 示例中,您希望将流量发送到另一个网关 10.19.84.213。唯一的方法是添加静态路由。这是正常行为。

相关内容