1

host A 192.168.2.4 in subnet 192.168.2.0

host B 192.168.3.53 in subnet 192.168.3.0

host C 192.168.3.54 in subnet 192.168.3.0

VM D 192.168.3.60 on host B, bridged network

  1. host A can ssh to host B and host C
  2. host B and host C can ssh to VM D

but,

  1. host A cannot ssh(even ping) to VM D

I use vagrant to launch the VM and the provider is VirtualBox.

Anyone can point out where the problem is? Thanks a lot.

JavyZheng
  • 53
  • 7

1 Answers1

1

Solved!

The Vagrant launched VirtualBox Vm has 2 NIC

eth0: 10.0.2.15
eth1: 192.168.3.60

and the default gateway is set 10.0.2.2.

if I want to ssh to the VM, I should set its default gateway same as the subnet 192.168.3.0(for example 192.168.3.252) and delete previous default gateway 10.0.2.2

So, what I have done on the vm to solve the problem is:

$ sudo route add default gw 192.168.3.252
$ sudo route del default gw 10.0.2.2

JavyZheng
  • 53
  • 7