index rss mastodon twitter github linkedin email
Álvaro Ramírez
sponsor

Álvaro Ramírez

17 December 2023 An basic Mullvad WireGuard setup for macOS

Needed a VPN to test an API from a different location. Gave Mullvad a try.

Pretty neat, you can generate an account number without providing an email address. You can also pre-pay with a ton of options, including cash, crypto, credit cards, PayPal, wire transfers…

After seeing your account credited, one can download a generated WireGuard configuration. Also a WireGuard noob, so took this opportunity to give it a try.

The WireGuard macOS app has an "Import Tunnel(s) from File…" option where you can import the .conf file downloaded from Mullvad's generated config. After that, all I had to do was click the "Activate" button and Bob's your uncle.

wg-redact.png

You can test your connection via:

curl https://am.i.mullvad.net/connected
You are connected to Mullvad (server xxxxxx). Your IP address is xxx.xxx.xxx.xxx

I had a brief stint at using the command-line alternative via homebrew brew install wireguard-go wireguard-tools, but that seems to fail silently:

wg-quick up xxxxx
[#] wireguard-go utun
[+] Interface for xxxxx is utun7
[#] wg setconf utun7 /dev/fd/63
[#] ifconfig utun7 inet xxx.xxx.xxx.xxx/xx xxx.xxx.xxx.xxx alias
[#] ifconfig utun7 inet6 xxxx:xxxx:xxxx:xxxx::x:xxxx/xxx alias
[#] ifconfig utun7 up
[#] route -q -n add -inet6 ::/1 -interface utun7
[#] route -q -n add -inet6 8000::/1 -interface utun7
[#] route -q -n add -inet xxx.xxx.xxx.xxx/x -interface utun7
[#] route -q -n add -inet xxx.xxx.xxx.xxx/x -interface utun7
[#] route -q -n add -inet xxx.xxx.xxx.xxx -gateway xxx.xxx.xxx.xxx
[#] networksetup -getdnsservers Wi-Fi
[#] networksetup -getsearchdomains Wi-Fi
[#] networksetup -getdnsservers iPhone USB
[#] networksetup -getsearchdomains iPhone USB
[#] networksetup -getdnsservers Thunderbolt Bridge
[#] networksetup -getsearchdomains Thunderbolt Bridge
[#] networksetup -getdnsservers xxxxx
[#] networksetup -getsearchdomains xxxxx
[#] networksetup -setdnsservers iPhone USB xxx.xxx.xxx.xxx
[#] networksetup -setsearchdomains iPhone USB Empty
[#] networksetup -setdnsservers xxxxx xxx.xxx.xxx.xxx
[#] networksetup -setsearchdomains xxxxx Empty
[#] networksetup -setdnsservers Wi-Fi xxx.xxx.xxx.xxx
[#] networksetup -setsearchdomains Wi-Fi Empty
[#] networksetup -setdnsservers Thunderbolt Bridge xxx.xxx.xxx.xxx
[#] networksetup -setsearchdomains Thunderbolt Bridge Empty
[+] Backgrounding route monitor
curl https://am.i.mullvad.net/connected
You are not connected to Mullvad. Your IP address is xxx.xxx.xxx.xxx

I'm on a Macbook M1 Pro, running macOS Sonoma. If you got wg-quick working on Sonoma, I'd love to hear from ya (Mastodon / Twitter / Reddit / Email).