Ubuntu is a Linux distribution thats really popular. Updated versions of Ubuntu come with WireGuard support built-in to it’s NetworkManager package. Setup is pretty straightforward, but here’s a step-by-step method.
This installation method should work for almost all Linux distributions, modifying how WireGuard get’s installed based on each distributions preferred package manager.
If you haven’t already, get WireGuard via Ubuntu’s package manager
apt. The commands are as follows.
sudo apt update
sudo apt install wireguard
When using WireGuard in Linux it’s super easy to generate your keys, the command below will create 2 files; one for the private key and one for the public key.
sudo wg genkey | tee private.key | wg pubkey > public.key
When finished you should have a complete WireGuard configuration saved as
In Linux there are multiple ways to do this. The simplest is via the command line, but NetworkManager supports WireGuard as well.
To start WireGuard via the command line, first copy the configuration to the proper location in
sudo cp wg0.conf /etc/wireguard/wg0.conf
wg0.conf is in it’s place you can use the
wg-quick command to bring the interface up.
sudo wg-quick up wg0
The output should look something like the following
[email protected]:~$ sudo cp /tmp/wireguard/wg0.conf /etc/wireguard/wg0.conf [email protected]:~$ sudo wg-quick up wg0 [#] ip link add wg0 type wireguard [#] wg setconf wg0 /dev/fd/63 [#] ip -4 address add 10.223.192.81/32 dev wg0 [#] ip -6 address add fdd7:2413:ae79:12d8::108b:eb5b/128 dev wg0 [#] ip link set mtu 1280 up dev wg0 [#] resolvconf -a tun.wg0 -m 0 -x [#] wg set wg0 fwmark 51820 [#] ip -6 route add ::/0 dev wg0 table 51820 [#] ip -6 rule add not fwmark 51820 table 51820 [#] ip -6 rule add table main suppress_prefixlength 0 [#] ip6tables-restore -n [#] ip -4 route add 0.0.0.0/0 dev wg0 table 51820 [#] ip -4 rule add not fwmark 51820 table 51820 [#] ip -4 rule add table main suppress_prefixlength 0 [#] sysctl -q net.ipv4.conf.all.src_valid_mark=1 [#] iptables-restore -n [email protected]:~$
NetworkManager provides a graphical user interface via Ubuntu’s Settings Dialogue. You can begin by opening up Network Settings in Ubuntu.
+ sign next to
VPN and then 'Import From File` to get started.
wg0.conf file and load it up!
Click ‘Add’ to add the configuration to NetworkManager.
From here just toggle the switch to connect!
You’ll also see the VPN icon in your system tray.
That’s it! You’re finished. Check your IP Address.
If you have any more questions or need additional help, give us a shout in our Support Category.