Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 05-26-2015, 02:18 AM   #1
LQ Newbie
Registered: Jul 2009
Posts: 21

Rep: Reputation: 0
Firewall restore and VPN kill switch


I would like to use kill switch feature for VPN in Ubuntu, i.e. to make it possible to access Internet only when I am connected to VPN and deny any access when I am without VPN.

I have followed steps here (, i.e. executed all the commands that begin with sudo in this one answer (replacing X.X.X.X with my VPN address and tun0 with wlan0), there were no errors in terminal but these settings don't work correctly.

When I have these rules enabled (sudo ufw enable) I cannot connect to VPN at all. There are also problems with correctly accessing websites outside VPN. How should I modify these commands?

The second question is how can I restore original settings? Before applying these commands I could connect to VPN normally, now I need to disable ufw before doing that. I have tried removing ufw and iptables with "sudo apt-get remove" and then installing them again with "sudo apt-get install" but I have impression that it does not restore firewall settings to default.

Thanks in advance!
Old 05-27-2015, 05:24 PM   #2
LQ Newbie
Registered: Jul 2009
Posts: 21

Original Poster
Rep: Reputation: 0
What else can I check to make it working? I have noticed that one issue was that I have written instead of providing its IP address (even if I add "sudo ufw allow out 53 # dns queries" it does not help). So after changing my VPN PPTP settings to IP address, the connection to VPN fails but after several seconds (earlier it was failing immediately). Still there is something missing in my rules.

I have checked ufw logs in /var/log/syslog and I can see the following difference between successful (after "sudo ufw reset") and unsuccessful (after applying rules) connection to VPN. There is timeout because it cannot sent control packet I think.

May 27 23:09:59 my-computer-name pptp[21137]: nm-pptp-service-21129 log[main:pptp.c:314]: The synchronous pptp option is NOT activated
May 27 23:10:15 my-computer-name pptp[21074]: nm-pptp-service-21064 warn[open_inetsock:pptp_callmgr.c:329]: connect: Connection timed out
May 27 23:14:33 my-computer-name pptp[21406]: nm-pptp-service-21398 log[main:pptp.c:314]: The synchronous pptp option is NOT activated
May 27 23:14:33 my-computer-name pptp[21420]: nm-pptp-service-21398 log[ctrlp_rep:pptp_ctrl.c:251]: Sent control packet type is 1 'Start-Control-Connection-Request'
What should I change in these firewall rules?

Thanks in advance!

Last edited by johnyjj2; 05-27-2015 at 05:27 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
IPSEC VPN "charon too long to start... - kill kill" saavik Linux - Networking 1 09-24-2013 12:39 PM
Android and kill-switch Dinithion General 8 06-25-2010 04:15 PM
Wireless gone after kill switch touched stash1071 Linux - Wireless Networking 3 08-12-2008 07:55 PM
enable the RF kill switch for ipw2200 Asuran Mandriva 9 11-28-2007 08:54 AM
Problem with Radio Kill Switch ppr:kut Linux - Wireless Networking 0 03-06-2007 02:08 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:51 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration