0

I get this error while configuring a network in Virtual Box with Linux.

I have 2 gateways (192.168.10.5 and 192.168.20.5) that are connected to 2 hosts. The first first host has address 10.0.10.100 and is connected to the gw via 10.0.10 1 while the other has 10 0 20 100 and is connected to the other gw via 10.0.20.1.

The gw are connected via host only network adapters. I have configured the hosts as gw with ip forward.

I make 10.0.10.1 and 10.0.20.1 default gateway for the two hosts. Then my idea was to route add (from 192.168.10.5) net 10.0.20.0 netmask 255.255.255.0 gw 192.168.20.5 but I got that error. Can not understand why. Do you have any solution?

Hope it is better

10
  • The gateway has to be on the same network as the client. If you're on 192.168.10.5, the gateway to get to 10.0.20.x has to have a 192.168.10.x address.
    – Barmar
    Feb 2, 2017 at 22:15
  • But I can ping from one gw to the other.
    – Rapax
    Feb 3, 2017 at 4:35
  • That's because you have a route to the other gateway. But Linux doesn't do recursive route lookup -- it won't use a gateway to get to a gateway. You have to tell it the first gateway to send to.
    – Barmar
    Feb 3, 2017 at 5:30
  • Ok, so from 10.0.10.x i have to add net 10.0.20.x through 10.0.10.1?
    – Rapax
    Feb 3, 2017 at 5:46
  • 1
    It would help if you showed a diagram of how everything is connected.
    – Barmar
    Feb 3, 2017 at 16:40

1 Answer 1

1

The tunnel between the gateways needs to be a common network.

One way would be to set its network mask to 255.255.0.0, so that all 192.168.x.x addresses are on the same network.

If you want to keep the 255.255.255.0 network mask, both gateways need to have 192.168.10.x (or 192.168.20.x) addresses.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .