> ## Content Index
> Fetch the complete content index at: https://developerinsider.co/llms.txt
> Use this file to discover other available public pages before exploring further.

# How to set up WireGuard Client on Ubuntu?
- URL: https://developerinsider.co/how-to-set-up-wireguard-client-on-ubuntu/
- Published: 2023-08-26T06:47:34.000Z
- Updated: 2024-10-21T03:41:05.000Z
- Description: Install WireGuard Client on Ubuntu and import WireGuard VPN config file to connect with WireGuard VPN Server. Manage Ubuntu WireGuard Client using network manager CLI and GUI tool.
- Author: Vineet Choudhary
- Tags: WireGuard, WireGuard Client, WireGuard Client Ubuntu, Ubuntu, Linux, Ubuntu WireGuard Client

WireGuard is an extremely simple yet fast and modern VPN. Setting up the WireGuard VPN client on Ubuntu is straightforward. In this tutorial, we will set up WireGuard VPN client on a Ubuntu Server/Desktop using `nmcli`.

## 1\. Install WireGuard

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

```sh
sudo apt update
sudo apt install wireguard

```

## 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:

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

```

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

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

```

**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:

```sh
nmcli connection show

```

**Output:**

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

```

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.

```sh
curl ifconfig.me

```

## 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:

```sh
nmcli connection up <wireguard-config-name>

```

**For example:**

```sh
nmcli connection up HomeVPN

```

### 4.2 Disconnect from WireGuard VPN:

```sh
nmcli connection down <wireguard-config-name>

```

**For example:**

```sh
nmcli connection down HomeVPN

```

## 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

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

```

**For example:**

```sh
nmcli connection modify HomeVPN autoconnect no

```

### 5.2 Allow only specific users to use VPN

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

```

**For example:**

```sh
nmcli connection modify HomeVPN connection.permissions vineet:vineet

```

## 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.

```sh
nm-connection-editor

```

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

![](https://cdn.developerinsider.co/images/linux/networking/wireguard-client-configuration-gui-ubuntu.webp)