Help me implement mullvad kill switch with ufw

I am trying to implement kill switch with ufw. Here are the rules:

ufw default deny incoming
ufw default deny outgoing

ufw allow in on wg0-mullvad from any to any
ufw allow out on wg0-mullvad from any to any

ufw allow out to <ip> proto udp
ufw allow from <ip> proto udp

ufw enable

I also execute mullvad relay set location ... to some hostname. <ip> is the “out” (endpoint) ip. But when I disconnect, I cant reconnect back to vpn unless I disable ufw. Please help me fix it.

Their supposed pages should answer your question. Please research more.

Sorry, I couldn’t find anything related to my question on the net. If you know something, please guide me there

Why are you doing this? Just use the built in lockdown feature: mullvad lockdown-mode set on

Recently I read an article and it was shown that mullvad leaks on reboot. So I want to have more stable solution