静态路由随机被忽略

静态路由随机被忽略

我有几个 Linux 客户虚拟机,它们通过桥接网络连接到我的物理适配器。出于某种原因,我无法将主机的子网用于客户虚拟机(虚拟适配器对我来说太慢了),因此我为它们创建了一个单独的子网。

在主机上我添加了来宾子网:

C:\> route add 192.168.20.0 mask 255.255.255.0 0.0.0.0 metric 1

关于客人:

# route add -host 192.168.148.87 dev eth3 # my host ip

它主要起作用:

basin@BASIN /cygdrive/c/Users/basin
$ tracert -d 192.168.20.20

Tracing route to 192.168.20.20 over a maximum of 30 hops

  1    <1 ms    <1 ms    <1 ms  192.168.20.20

Trace complete.

basin@BASIN /cygdrive/c/Users/basin
$ tracert -d 192.168.20.21

Tracing route to 192.168.20.21 over a maximum of 30 hops

  1    <1 ms    <1 ms    <1 ms  192.168.20.21

Trace complete.

但看起来有些数据包通过了网关:

basin@BASIN /cygdrive/c/Users/basin
$ tracert -d 192.168.20.23

Tracing route to 192.168.20.23 over a maximum of 30 hops

  2    <1 ms    <1 ms    <1 ms  192.168.200.1 0
  3  192.168.200.1  reports: Destination host unreachable.

Trace complete.

与来宾的 SSH 连接经常停滞。我做错了什么?

IPv4 Route Table
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway       Interface  Metric
          0.0.0.0          0.0.0.0  192.168.149.200   192.168.148.87     20
        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.20.0    255.255.255.0         On-link    192.168.148.87     21
   192.168.20.255  255.255.255.255         On-link    192.168.148.87    276

     192.168.56.0    255.255.255.0         On-link      192.168.56.1    266
     192.168.56.1  255.255.255.255         On-link      192.168.56.1    266
   192.168.56.255  255.255.255.255         On-link      192.168.56.1    266

    192.168.148.0    255.255.254.0         On-link    192.168.148.87    276
   192.168.148.87  255.255.255.255         On-link    192.168.148.87    276

  192.168.149.255  255.255.255.255         On-link    192.168.148.87    276
        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.148.87    276
        224.0.0.0        240.0.0.0         On-link      192.168.56.1    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    192.168.148.87    276
  255.255.255.255  255.255.255.255         On-link      192.168.56.1    266
===========================================================================

更新:

可能是操作系统向不同的地方发送了一些 ICMP 请求,而回复覆盖了我的静态路由?如何检查?

答案1

仅当目标地址不在直接连接的网络上时才使用静态路由。在您的例子中,所有主机都在直接连接的网络上,因此静态路由将被忽略。

相关内容