How to ping a VM going through another VM in the same network without pinging directly?
Posted: 18. Jul 2020, 18:59
I have 3 VMs on the same network using host-only adapters. We can call them VM1, VM2, and VM3. VM1 is already able to directly ping VM3. However, I would like VM1 to ping VM3 going through VM2. How can I change this behavior?
I tried to change the routes as follows:
Initially, when I type route -n in VM1:
192.X.X.0 is the network where my 3 VMs run.
Then I added a route where 192.X.X.11 is VM2
VM2 is regarded as a switch thanks to OpenvSwitch (OVS) but when I try to ping VM3, VM1 ping directly VM3. I used traceroute and tracepath to check this result. How can I change the route to go through VM2?
I tried to change the routes as follows:
Initially, when I type route -n in VM1:
Code: Select all
Destination Gateway Genmask Flags Metric Ref Use Iface
169.X.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s3
192.X.X.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3Then I added a route where 192.X.X.11 is VM2
Code: Select all
Destination Gateway Genmask Flags. Metric Ref Use Iface
169.X.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s3
192.X.X.0 192.X.X.11 255.255.255.255 UGH 0 0 0 enp0s3
192.X.X.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3