Say you have configured VPN already and the interface is the default name,
Say you have Transmission installed and want to force it to work through the VPN only.
If installed on ubuntu, it should run as user
debian-transmission which is a convenient handle by which to control its traffic.
Using iptables, we can, for any process whose owner is debian-transmission:
- route packets destined to any machine on our LAN (192.168.1.0/24), thus allowing our HTTP client to work
- after 1., drop packets only if they travel over any interface other than tun0
I learned this from http://www.botcyb.org/2012/11/force-application-to-use-vpn-using.html
There are a few ways to do this; here is the way I prefer it.
Save your rules off to a file:
sudo sh -c "iptables-save > /etc/iptables.rules"
Add up and/or down hooks to interfaces in
I learned this from https://help.ubuntu.com/community/IptablesHowTo