Mullvad VPN using dnscrypt-proxy instead of vpn dns

If you are using wireguard, one approach is to use network namespaces. A network namespace gets a separate network stack and you can override things like nsswitch.conf on a per-namespace basis. WG works very well with this model as you can create an adapter in the default namespace and then move it inside the NS.

Here’s a flake with some sample code. And a bash script that does a similar thing.

Alternatively resolvconf can set up per-adapter DNS servers but I personally never had good experience with it.

2 Likes