When vpn is connected with a kill switch, certain processess like ubuntu push notification and pantalimon (and may be other processess) are still associated with the old gateway and not the VPN gateway.
When sudo netstat -tunlpaw is issued in the terminal
Certain processess are ESTABLISHED with the router gateway address (for ex: 192.168.1.xx) and
sudo kill -HUP xxxx (where xxxx is the PID number of the process) needs to be issued to re-associate this process to the VPN gateway.
Sometimes that doesnt work and sudo kill xxxx (without -HUP option) needs to be issued to kill the process running outside of VPN. Is there a solution for this where i dont have to constantly use this workaround everytime my VPN connection drops ?
PS: my kill switch uses ufw with the following:
Below is run after VPN connection is established
sudo ufw reset
sudo ufw default deny incoming
sudo ufw default deny forward
sudo ufw default deny outgoing
sudo ufw allow out on tun0 from any to any
sudo ufw enable
And i use the below commands before reconnecting to my VPN
sudo ufw reset
sudo ufw deny incoming
sudo ufw deny forward
sudo ufw allow outgoing
sudo ufw enable