
If you connect to the internet through a public WiFi hotspot, or at school or at work, the metadata and contents of your online communications can be intercepted and viewed (or altered) by the network operator or another malicious party on the network. One of the ways to protect your privacy is to send all of your internet traffic through a Virtual Private Network.
Unfortunately a lot of personal data can leak out when you join a new network but have not yet connected the VPN. This guide shows you how to configure the Linux iptables firewall to block all normal outgoing connections, and only allow connections to your VPN server.