Results 1 to 2 of 2
Hello, I'd like to configure IPtables to make sure I can only access the internet through an openvpn connection (so when the connection is down I have no way to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-24-2011 #1Just Joined!
- Join Date
- May 2011
- Posts
- 3
How to only allow OpenVPN connections with IPtables ?
Hello, I'd like to configure IPtables to make sure I can only access the internet through an openvpn connection (so when the connection is down I have no way to access the internet but to connect to the vpn again).
I know how to do this with Firestarter (restrictive outgoing policy and I only allow the vpn server IPs) but Firestarter seems to be stupid : for some reason eth0 was changed to eth1 and Firestarter can't work properly anymore, even though that probably can be fixed with Firestarter I'm no more interested in this program and I'd better like to know how to apply the same policy using IPtables.
I've tried a few things already but it failed each time ... how can I effectively allow my computer to connect to the VPN while everything else is blocked ?
My current set of rules :
Code:# Generated by iptables-save v1.4.10 on Mon May 23 18:02:08 2011 *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -i lo -j ACCEPT -A INPUT -i tun+ -j ACCEPT -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A INPUT -s xx.xxx.xx.xx -j ACCEPT -A INPUT -j DROP -A OUTPUT -o tun+ -j ACCEPT -A OUTPUT -d xx.xxx.xx.xx -j ACCEPT -A OUTPUT -j DROP COMMIT # Completed on Mon May 23 18:02:08 2011
What should I change ?
- 05-27-2011 #2
Are you sure the interface is tun+? If not you need to change this.
Also I cleaned up your rules for you
If you are going to use Connection tracking then you need the rules to be setup to use them. Also your policy should always be set to DROP.Code:# Generated by iptables-save v1.4.10 on Mon May 23 18:02:08 2011 *filter :INPUT DROP [0:0] :FORWARD DROP [0:0] :OUTPUT DROP [0:0] -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -i tun+ -m conntrack --ctstate NEW -j ACCEPT -A INPUT -s xx.xxx.xx.xx -m conntrack --ctstate NEW -j ACCEPT -A INPUT -j DROP -A OUTPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -A OUTPUT -o -i lo -j ACCEPT -A OUTPUT -o tun+ -m conntrack --ctstate NEW -j ACCEPT -A OUTPUT -d xx.xxx.xx.xx -m conntrack --ctstate NEW -j ACCEPT -A OUTPUT -j DROP COMMIT # Completed on Mon May 23 18:02:08 2011


Reply With Quote
