0

How to set up WireGuard Client on Debian?

WireGuard is an extremely simple yet fast and modern VPN. Setting up the WireGuard VPN client on Debian is straightforward. In this tutorial, we will set up WireGuard VPN client on Debian using nmcli.

1. Install WireGuard

First of all, we need to install the WireGuard on your Debian Desktop/Server. Use the following commands to update the package index and install WireGuard:

sudo apt update
sudo apt install wireguard

Copy

2. Import WireGuard Connection Configuration File

Now with the help of nmcli, we need to import the WireGuard connection configuration file. Use the following command to import the WireGuard connection configuration file:

nmcli connection import type wireguard file <path/to/wireguard.conf>

Copy

Replace the <path/to/wireguard.conf> with your WireGuard configuration file. For example:

nmcli connection import type wireguard file ~/Documents/VPNConfigs/HomeVPN.conf

Copy

After successful import you’ll see a message like this:

Connection 'HomeVPN' (c8dcf423-2d43-416e-bd02-810729f7f89f) successfully added.

Copy

Note – The name of the WireGuard config file must be a valid interface (without space and special characters) name followed by “.conf”.

3. Test WireGuard VPN Connection

Now if we run the nmcli connection show, we can see a connection for WireGuard VPN. The type of a connection will be wireguard as follows:

nmcli connection show

Copy

Output:

NAME          UUID                                  TYPE       DEVICE
Starlink      126a16c0-9ee2-456a-b932-ec075621da2e  wifi       wlp3s0
HomeVPN       c8dcf423-2d43-416e-bd02-810729f7f89f  wireguard  HomeVPN

Copy

To check your external IP if you are connected to the VPN or not you can run the following command. This will print your external IP on the console.

curl ifconfig.me

Copy

4. Connect/Disconnect from WireGuard VPN

To connect or disconnect from the WireGuard VPN we need can run the following command:

4.1 Connect to WireGuard VPN:

nmcli connection up <wireguard-config-name>

Copy

For example:

nmcli connection up HomeVPN

Copy

4.2 Disconnect from WireGuard VPN:

nmcli connection down <wireguard-config-name>

Copy

For example:

nmcli connection down HomeVPN

Copy

5. Modify WireGuard VPN Connection Settings

With the help of nmcli, we can also modify different settings. Here we’ll look into some main settings

5.1 Enable/Disable Auto-connect

nmcli connection modify <wireguard-config-name> autoconnect no|yes

Copy

For example:

nmcli connection modify HomeVPN autoconnect no

Copy

5.2 Allow only specific users to use VPN

nmcli connection modify <wireguard-config-name> connection.permissions <user:user1>,<user:user2>

Copy

For example:

nmcli connection modify HomeVPN connection.permissions vineet:vineet

Copy

6. Modify WireGuard VPN Connection Settings using GUI

With the help of nm-connection-editor, we can manage/modify the same settings in GUI. Just run the following command and it will open Advance Network Configuration GUI.

nm-connection-editor

Copy

Now double-click on WireGuard configuration name to manage/modify WireGuard VPN connection settings using GUI.

Добавить комментарий

Облачная платформа

Свежие комментарии

Подписка

Лучшие статьи

WordPress › Ошибка

На сайте возникла критическая ошибка.

Узнайте больше про решение проблем с WordPress.