Reputation: 63
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
but,
I use vagrant to launch the VM and the provider is VirtualBox.
Anyone can point out where the problem is? Thanks a lot.
Upvotes: 1
Views: 364
Reputation: 63
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
Upvotes: 1