This is probably gonna be a pretty noob question but I'm experimenting with some networking stuff in my place and there's a lot I still don't understand so... here it goes.
Following some guides and tutorials online I created a VM running Ubuntu Server 17.04 with an OpenVPN installation and my account configured then some iptables rullings so that all traffic would be router through the VPN and if the tunnel goes down it would stop working. If in another computer in the network I set the gateway IP address to that VM traffic does get routed through the VPN and if I kill the tunnel then internet access gets cut off as well. So far so good, everything working as expected.
Next step was to install Privoxy in that same VM and set it to listen to incoming connections from the network instead of just localhost. On that previous computer I set the default gateway back to my router's IP (192.168.1.1) and configure the proxy so that all HTTP/HTTPS traffic gets router through the VM -> Privoxy -> VPN. Working great again!.
Now, my problem is that with this setup with the VPN and Privoxy if the VPN tunnel goes down the connection isn't cut off anymore and everything just goes out through my real IP address.
Here are the iptable rules I'm using -> link.
Pretty sure I screwed up somewhere or maybe it's something I'm missing without realizing and I'd appreciate any possible help!.