Score:0

Permanent Internet Access for Host-only Adapter w. UFW Killswitch

tr flag

According to documentation found here. https://help.ubuntu.com/community/Internet/ConnectionSharing

I can establish temporary internet access for my vbox using a single host-only adapter, a static ip inside the vbox, and my UFW settings, using the following commands:

$sudo iptables -A FORWARD -o wg0 -i vboxnet5 -s 192.168.61.0/24 -m conntrack --ctstate NEW -j ACCEPT
$ sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
$ sudo iptables -t nat -F POSTROUTING
$ sudo iptables -t nat -A POSTROUTING -o wg0 -j MASQUERADE

However, these commands are transient and vanish after reboot. I can take a shortcut and set a bash script to run at boot, but I'd rather learn the proper way to do this.

Any tips? Thanks

Score:0
tr flag

The solutuion here was quite simple.

sudo nano /etc/ufw/before.rules

In this section of the file:

#NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]

Add:

-A POSTROUTING -s 192.168.61.0/24 -j MASQUERADE

Now all traffic 192.168.61.0 will be sent through the host primary network interface even if it changes (i.e. wifi vs lan)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.