2

Pretty simple use case. Let's say I use various applications, and at no such time can any of these applications ever transmit data natively from my actual connection.

Here's my actual problem in more detail. I am using OpenVPN to connect various client-server applications. It is paramount that these are always sending data through the VPN. The VPN is not optional, it is a mandatory. Sadly when the VPN dies, or is forgotten to be turned on, or somehow mysteriously turns itself off... these applications start sending packets through my native connection. This is a huge no-no. I'm sure there is a solution to this problem, yet duckduckgo'ing it and research on it hasn't been productive sadly.

Also as it says in the title, I don't have access to configure my router for this. I am open to using a Virtual Machine and perhaps locking just that down to tunneled connections only.

2 Answers 2

3

Using iptables (linux firewall) I am able to restrict access to only the VPN connection:

#Clear all previous entries
iptables -F

iptables -A INPUT -i tun+ -j ACCEPT

iptables -A OUTPUT -o tun+ -j ACCEPT

iptables -A INPUT -s 127.0.0.1 -j ACCEPT

iptables -A OUTPUT -d 127.0.0.1 -j ACCEPT

#myvpn.com
iptables -A INPUT -s myvpn.com -j ACCEPT

iptables -A OUTPUT -d myvpn.com -j ACCEPT

#DNS
#openVPN needs DNS to resolve hostnames before it connects. If you are paranoid about dnsleakge, which isn't supposed to be a problem with VPN as all connections are tunneled, you can remove this entry, and then run these iptables commands after you connect to the VPN.
iptables -A INPUT -s 8.8.4.4 -j ACCEPT

iptables -A OUTPUT -d 8.8.4.4 -j ACCEPT

iptables -A INPUT -j DROP

iptables -A OUTPUT -j DROP
0

The quick and easy solution is going to be to go with the VM route and bind it exclusively to the network device you want it to use (in this case your VPN).

As you already indicate that this is a viable solution and do not reference the VM platform you prefer I'll skip detailing any walk-throughs on configuration steps. But, with all of the platforms I've used (VMWare, VirtualBox, etc...) the configuration is pretty straight forward, the key thing is to disable any VM bindings to your non-VPN network devices. If you want specifics I'd suggest looking to see if that's already been answered, or if not, asking a new question on that topic.

4
  • Update: Yes, as indicated in my question this is a possibility. Sadly this did not work. I can specify my wireless card, but the open vpn network adapater "TAP Win-32" just doesn't work. The VM fails to connect to the internet this way. I'm looking into creating firewall rules that disable all other non-vpn connections
    – Zombies
    Mar 22, 2014 at 7:09
  • What VPN and VM software are you using if I might ask. I'd like to do some extra checking on this.
    – Bryan C.
    Mar 23, 2014 at 0:35
  • Windows? OpenVPN client. Same on Linux.
    – Zombies
    Mar 23, 2014 at 5:50
  • Ok, then this might be a dead end. Going this route with the built in Windows VM is going to start getting way more complicated then a Stack answer is going to be able to flesh out, and if you've already got an IPTables solution worked out in your Linux session (and you have the level of skill to work that out), then I'd just stick with that. Sorry bud.
    – Bryan C.
    Mar 24, 2014 at 0:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .