0

I want to connect a VM to a VPN and only to that VPN; shows up as ppp0 in the list.

I cannot select ppp0 in the vbox bridged adapter list. The VPN works fine and I can access it if I just select "NAT" in the vbox network menu; but then my VM can access the internet; which I don't want to happen.

Also I don't want any of my regular traffic going via the VPN.

What would be the best way to go about this?

Note: the VPN is only active some of the time (it connects to a license server for some SW that I use, I need weekly connections to the server)

0

I would write a script that set specific firewall rules to achieve your goal, in your case, it sounds like you don't want any traffic going out over an unencrypted interface. I use a script that I mostly stole that might help. (on my system my vpn interface is called tun0 ((tunnel 0)).

sudo ufw reset sudo ufw default deny incoming sudo ufw default deny outgoing sudo ufw allow out on tun0 from any to any sudo ufw enable

Your interface appears to be ppp0 so substitute accordingly.

This script adjusts the firewall rules so that traffic can only come in or go out over your vpn (tun0, or in your case, ppp0).

If you somehow drop your vpn connection - all traffic stops until you re-authenticate or revert back to your original firewall policies.

Along those lines, you'll need a script that undoes all of this if you decide to access the internet with an unsecured connection. (Like if you need to reconnect to your vpn if it decides to drop your connection)

sudo ufw reset sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw enable

Once you get back on your vpn, run the first set of rules to make sure that ppp0 or tun0 or whatever your encrypted interface is called is restricted to your encrypted interface.

I should point out that you run that first script AFTER you connect to your vpn. If you run it before, you won't be able to connect to your vpn.

You run the second script after you drop your VPN connection.

I should also point out that I can't swear on the bible that's going to work in a VM. You can confirm for sure by purposely dropping your vpn connection and watching the traffic via a utilty like bmon. Or you could just try to ping yahoo.com or something like that. Trust me, if you run these rules, all traffic stops the moment that the vpn drops.

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.