Using WireGuard

Hi,
I installed WireGuard tools with Brew.
I have the file mentioned in /etc/wireguard.

Using the quick-connection-command with the provided configuration file (with the keys) doesn’t work. I looked for /dev/fd/63 and I don’t seem to have a file or folder named 63 in that place.

❯ sudo wg-quick up belgie
[#] ip link add belgie type wireguard
[#] wg setconf belgie /dev/fd/63
Name or service not known: `undefined.vpn.mega.nz:51820'
Configuration parsing error
[#] ip link delete dev belgie

I’m following this guide from MEGA (I have their VPN):

In the meantime, you could generate the VPN credentials, to be used in the WireGuard client for Linux. In order to do that, please refer to the guide below:

  1. Access Installation - WireGuard and download the version that matches with your system.

Copy the install command from the site and paste it in your Linux terminal. Note that the system will request your admin password.

  1. Access your MEGA account through a browser, then navigate to Settings - VPN (or click here MEGA).

On the credential section, select the country you want to connect and click on ‘Generate VPN credentials’.

The system will create a QR code with a download button, please download the credential.

  1. On your Linux system, open /etc and open the Wireguard folder (note that this is a system folder, therefore, it will be necessary to enter your administrator credentials).

Copy the VPN file from the location you downloaded it and paste it in the Wireguard folder.

Note that we recommend you rename the file name to one that you will easily identify. I.e. Spain if you create a credential to connect to Spain.

  1. Open your terminal and execute the command sudo wg-quick up ‘vpn filename’

This will connect your VPN.

Note: ‘vpn filename’ has to be introduced without apostrophes ('), and without the extension file name. E.g., to use ‘Spain.conf’ file, please introduce ‘wg-quick up Spain’

  1. If during the connection attempt the system returns with an error /usr/bin/wg-quick: line 32: resolvconf: command not found then it means that your system will need an additional package for the VPN.
    Simply execute sudo apt install openresolv to install the missing package.

  2. Once installed, please execute the connection command again.

  3. To disconnect the VPN, simply execute sudo wg-quick down ‘vpn filename’

EDIT:
This is the conf-file:

[Interface]
PrivateKey = xxxx
Address = xxxxx
DNS = xxxx

[Peer]
PublicKey = xxxxx
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = undefined.vpn.mega.nz:51820

So that Endpoint is the problem, but I can’t find the correct address by websearching.

Hello @Jonasan

Wireguard is pre-installed in Bluefin, and I suppose in all Universal Blue flavours, so no need to install it again via brew.

That being said, the configured endpoint FQDN is not resolvable, so I recommend you to reach out to the VPN provider (i.e. Mega VPN) to find out what it should be.

Cheers,

Thanks asantiago, I reached out to MEGA, but no response so far. I’ll post the result here.
Should I remove the brew-WireGuard? I didn’t get a message that it was already installed, so I guess I have a second and different kind of installation.

First confirm wireguard is installed in your image by running the following command:

❯ rpm -qa | grep wireguard
wireguard-tools-1.0.20210914-6.fc40.x86_64

~ 

If its output shows “wireguard-tools” as above, go ahead and remove brew wireguard.

Thank you very much @asantiago . I checked and I got the exact same response. I removed the brew version.

The problem wasn’t with WireGuard. MEGA responded.

I removed the old credentials, generated new credentials and left the name unchanged (placed them in etc/Wireguard). Then sudo wg-quick up vpn-1-xxxxxx worked.