You are not logged in.

#1 2013-02-28 22:36:07

gbj13
Member
Registered: 2010-05-06
Posts: 109

How to prevent non VPN traffic?

I have a VPN connection that is configured as tun0. My intention is to ensure that all my traffic goes through that VPN connection. What I have found is that occassionally, that VPN connection will drop down and traffic will begin routing through eth0 without me knowing and as I have a data cap on my connection this is bad hmm

Could someone point me to how I might best be able to ensure that I have no traffic running across eyh0, other than of course the ability to create the connection to vpn/tun0?

Any help would be greatly appreciated.  Thanks.

Offline

#2 2013-03-01 00:43:02

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: How to prevent non VPN traffic?

iptables?


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#3 2013-03-01 00:54:55

gbj13
Member
Registered: 2010-05-06
Posts: 109

Re: How to prevent non VPN traffic?

Yes, but how do I do it with iptables?  Do you know of a good tutorial for this?

Offline

#4 2013-03-01 01:13:22

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,178

Re: How to prevent non VPN traffic?

Have you read the wiki? What have you tried? I mean, you can use iptables to block everything on a certain interface, for example. The wiki has lots of information about different firewall setups. Even if it does not deal with this issue specifically, you should be able to find lots of pointers and information.

Last edited by cfr (2013-03-01 01:15:07)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#5 2013-03-01 01:19:26

gbj13
Member
Registered: 2010-05-06
Posts: 109

Re: How to prevent non VPN traffic?

Yes read the wiki.  The problem was always that the iptables refused to recognize the --dport option for some reason.  I finally managed to get this working with the following rules.

iptbales -A OUTPUT -o tun0 -j ACCEPT
iptables -A OUTPUT -d XXX.XXX.XXX  -j ACCEPT
iptbales -A OUTPUT -j DROP

Where XXX.XXX.XXX is my vpn providers ip adress.  It seems to be working at the moment.

Offline

Board footer

Powered by FluxBB