Wireguard #
I frequently use VPN. I subscribe to a popular VPN service which supports Wireguard. Up until now I’ve been using their linux app to connect to their servers. It is a useful app. It shows you all the available servers and some metadata about how busy they are. And you can click a button to connect to a specific server. You can also click a button to connect to “the fastest” server available. That’s nice. Most importantly it automatically sets up a kill switch so that you don’t leak any traffic on other network interfaces. I’ll add that to this post after I set that up at a later time.
But I don’t like GUIs all that much because I have to use a mouse. I like to do things from the command line.
Set up #
- Install wireguard
- Download wireguard conf from provider
- On ubuntu, ensure you symlink resolvconf
I’m on Ubuntu and based on this StackExchange answer, I found that the simple solution was to symlink the systemd equivalent of resolvconf to resolvconf.
ln -s /usr/bin/resolvectl /usr/local/bin/resolvconf
Usage #
To use a provider’s configuration you move it to /etc/wireguard and then you can use the utility wg-quick.
Example #
Move your downloaded conf file to /etc/wireguard/location-99.conf. Then you can connect with sudo wg-quick up location-99. And you can see the current status of your connection with sudo wg.
Bonus points #
You can also see your network connectivity with the useful tool nmcli.
❯ nmcli c show --active
NAME UUID TYPE DEVICE
NW Portland Hostel 123abcde-fg45-6789-abcd-abcdef567890 wifi wlp46s0f0
location-99 123abcde-fg45-6789-abcd-abcdef123456 wireguard location-99