Hello SuperUser Community!!

I'm so happy to write here, I'm stuck on a strange issue:

I've 2 VM on my VirtualBox lab

one VM has only the HostOnly Interface (eth0) the other VM has the HostOnly Interface (eth0) and also a NAT Interface (eth1) with public internet access (ping result OK)

So I just want do a very simple task: I wanna ping via the first VM, so I added a route on this VM saying to use the HostOnly Interface in order to find

ip route add dev eth0

I enabled the Forwarding Packets option on the second VM:

sudo echo 1 > /proc/sys/net/ipv4/ip_forward

And I tried, with no success, I mean, on the second VM I receive the Ping request from the first VM but I don't obtain response.

Can you help me?

If can help, here the IPs assigned to the VMs: -Net conf of VM 1: eth0: (host only net) -Net Conf of VM 2: eth0: (host only net), eth1: (with public access).

Thank you so much!!!

  • Your 1st VM is connected to host only. There are only 2 machines in this network: host and VM. There's no – gronostaj Jul 17 '20 at 14:36
  • actually from VM1 I can ping VM2 and if I ping from VM1, VM2 receive the Ping (due to the static route added) – alessandro Jul 17 '20 at 14:38

try to MASQUERADE the packet received in the VM2. In your case, I would try with:

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
  • Thank you Giuseppe! It worked, you made my day. Bye! – alessandro Jul 18 '20 at 21:30

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.