Skip to content

Instantly share code, notes, and snippets.

@khanghh
Created March 11, 2020 09:14
Show Gist options
  • Save khanghh/40f760089c1c6178b66d6d3c91b61ba0 to your computer and use it in GitHub Desktop.
Save khanghh/40f760089c1c6178b66d6d3c91b61ba0 to your computer and use it in GitHub Desktop.
host only network internet access
iptables -t filter -I FORWARD --in-interface vboxnet0 --out-interface <HOST_INTERFACE_WITH_INTERNET> --source 192.168.56.0/24 -j ACCEPT
iptables -t filter -I FORWARD --in-interface <HOST_INTERFACE_WITH_INTERNET> --out-interface vboxnet0 --destination 192.168.56.0/24 -j ACCEPT
iptables -t nat -I POSTROUTING -o <HOST_INTERFACE_WITH_INTERNET> -j MASQUERADE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment