Skip to main content
1 of 4
Alexios
  • 19.5k
  • 3
  • 60
  • 76

Why don't you change the VM to use bridged networking? It'll then get its own equivalent of eth0 and wlan0.

For a more general solution (in addition to the iptables rules), you'll need to turn your host computer into a router by enabling packet forwarding. Put:

net.ipv4.ip_forward=1

in /etc/sysctl.conf, then say

sudo sysctl -p /etc/sysctl.conf.

Alternatively:

echo 1 | sudo tee /proc/sys/net/ipv4_ip_forward

The guest must also have a default route that gateways pakcets through the host (and for this, chances are host-only mode just won't work). Check its routing table (this depends on the guest OS).

Also, install wireshark or tshark and use them to examine packets. There's no better way to solve generic networking issues like that.

Personally, I'd suggest changing the guest to use bridged mode networking and making available to it both of the host's interfaces. Then it can connect on its own, using the DHCP service on your router to get a local address on its own. No NAT needed.

Alexios
  • 19.5k
  • 3
  • 60
  • 76