Disclaimer: I have no experience with Linux or networking whatsoever.

I want to block all non-vpn traffic on my Fedora 25 PC. That means, only my VPN provider's IPs should ever be allowed for any internet traffic. I also want to use only their DNS server.

Is there a simple way to do this?


'I have no experience with Linux'

runs Fedora

sudo dnf install ufw
sudo ufw default deny incoming
sudo ufw default deny outgoing
sudo ufw allow out to [VPN server IP] port 443 proto udp
sudo ufw allow out to [VPN provider's DNS IP] port 53
sudo ufw allow out on tun0 from any to any
sudo ufw enable
  • DNS server, per question, too? – roaima Apr 2 '17 at 7:16
  • These commands have a rather large security/privacy problem: They allow dns to occur outside of the VPN. The question asker almost certainly wants the DNS inside the VPN. To fix it, remove the line 'sudo ufw allow out to [VPN provider's DNS IP] port 53'. You see, if the DNS was occurring over the VPN tun0 there's no need to have an extra ufw rule about it. – iPherian Jun 1 at 13:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.