Setting IPTables to disconnect when disconnecting from VPN


I want to touch on such a big problem, which is very easily solved. 


Not once did it happen that the connection to the VPN is broken and you have dark business going on there. Not very comfortable, and risky. 

Yesterday, after the next break, I thought that there should be methods that would save us from such things. After I learned about IPTables (by the way, I strongly recommend starting learning because it is a very useful thing).
It turns out a very short command can be made so that the packets do not miss when you disconnect from our VPN. 

Set a rule:
iptables -I FORWARD -s 123.132.123.123 -j DROP // 123 .... this is the IP of your VPN
Delete rule:
iptables -D FORWARD -s 123.132.123.123 -j DROP
View rules:
iptables -L

Commentaires

You are welcome to share your ideas with us in comments!