Skip to content

Instantly share code, notes, and snippets.

@samos123
Created November 2, 2014 02:47
Show Gist options
  • Save samos123/dd6c2320507983df8b64 to your computer and use it in GitHub Desktop.
Save samos123/dd6c2320507983df8b64 to your computer and use it in GitHub Desktop.
Giving a host only virtualbox network internet access by making the vboxhost a natted router
#!/bin/bash
network_with_inet_access=wlan0
private_natted_network=vboxnet1
sudo iptables -t nat -A POSTROUTING -o $network_with_inet_access -j MASQUERADE
sudo iptables -A FORWARD -i $private_natted_network -o $network_with_inet_access -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i $private_natted_network -o $network_with_inet_access -j ACCEPT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment