Create VPN Kill Switch in Ubuntu using UFW

sudo apt update
sudo apt upgrade -y
sudo nano /etc/sysctl.conf
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
sudo sysctl -p
cat /proc/sys/net/ipv6/conf/all/disable_ipv6
sudo nano /etc/default/ufw
sudo ufw disable
ip addr | grep inet
sudo ufw allow in to 192.168.43.245/24sudo ufw allow out to 192.168.43.245/24
sudo ufw default deny outgoingsudo ufw default deny incoming
ip addr | grep inet
sudo ufw allow out on tun0 from any to any
sudo ufw allow in on tun0 from any to any
sudo ufw enable

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store