Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd, 2017 please sign up again. Thanks!

  1. More ways to get the info! - we shoot all of our new original content out as well as random messages on Twitter and our newsletter!. Twitter | Newsletter
    Dismiss Notice

Firewall restore and VPN kill switch

Discussion in 'Linux Networking' started by johnyjj2, May 26, 2015.

  1. johnyjj2

    johnyjj2 Guest


    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 on the other website (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. I cannot provide link to that other website because this forum does not let me do that.

    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!

    (Log in to hide this advertisement)

    PS Full disclosure - this is cross-posting (I cannot provide link because this forum does not let me do that).
  2. johnyjj2

    johnyjj2 Guest

    What else can I check to make it working? I have noticed that one issue was that I have written name.of.my.vpn 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.

    What should I change in these firewall rules?

    Thanks in advance!
  3. Well, I've found a site that looks like it might be the answer. I have not tried it because I do not understand some of them. It describes how to use kill kill switch in a special script written by another person. I'm not saying it would work, but it can work if you want to try. Let me know what you decide and how it works for you.
    From here found the detail: vpnranks_com/vpn-with-kill-switch/
    #3 jameshouston135, Mar 15, 2017
    Last edited: Mar 15, 2017

Share This Page