0

I have two interfaces connected to a real machine, eth0 and vboxnet2 (a VirtualBox bridged network).

eth0 is sitting on 192.168.15.x and is connected to my ADSL modem. vboxnet2 is on 192.168.200.x.

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.15.1    0.0.0.0         UG    0      0        0 eth0
192.168.15.0    *               255.255.255.0   U     1      0        0 eth0
192.168.200.0   *               255.255.255.0   U     0      0        0 vboxnet2

Should I be able to ssh from (say) 192.168.15.100 to 192.168.200.4? My understanding of the routing table is that it says "if you see any packets destined for 192.168.200.x, send them to the vboxnet2 interface". Doesn't seem like I need NAT, iptables magic, or bridged networking for that. But it isn't working ("No route to host").

Long time Linux user, but networking details have fallen off the mental stack in the last few years as NetworkManager started to do everything...

0

You need to enable routing with echo 1 > /proc/sys/net/ipv4/conf/all/forwarding. Then in addition you need to set up the appropriate routes on other machines. So on 192.168.15.100 you need to say something like ip route add 192.168.200.0/24 via 192.168.15.x (where x is whatever the forwarding machine's IP address is). Similarly, you will need to add a route on your virtual machine for 192.168.15.0/24.

2
  • 1
    Did you mean /25 or /24? – Greg Bell Aug 29 '15 at 0:20
  • 1
    It should be ip route add 192.168.200.0/24 via 192.168.15.x on 192.168.15.0/24 hosts because 192.168.200.x is unreachable from those hosts. – yaegashi Aug 29 '15 at 4:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.