static route randomly ignored

2

I have a couple of Linux guest VMs with bridged network to my physical adapter. For a certain reason I can't use the subnet of my host machine for the guests (and virtual adapter is too slow for me), so I created a separate subnet for them.

On host I added the guest subnet:

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

On guests:

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

It mostly works:

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.

But it looks like some packets go through the gateway:

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 connections to the guests often stall. What am I doing wrong?

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
===========================================================================

Upd:

Could it be that OS sends some ICMP request to different places and the reply overrides my static route? How to check this?

basin

Posted 2016-06-21T13:01:46.680

Reputation: 394

what virtualization solution are you using? I used VirtualBox on Windows (now I am on OS X and still using VirtualBox) and it has a nice Networking part which does not need additional setup on host/guest as you described. – Zina – 2016-06-21T22:26:49.130

@Zina I use VirtualBox. I explained my case in the 1st paragraph. Bridge gives me 2.5Gbit. Other modes - 100Mbit – basin – 2016-06-22T06:37:52.010

strange you cant get more than 100Mbit with other connections. What type of adapter did you select? A 1Gb or the PCnet? And I don't see where from the hop to 192.168.200.1 came? I do not see it in your routing table. – Zina – 2016-06-22T22:45:34.373

Answers

1

Static routes are only used if the target address is not on directly connected network. In your case all hosts are on directly connected networks, so the static routes are ignored.

Thunderbelch

Posted 2016-06-21T13:01:46.680

Reputation: 11