Guide compatible with LXC VPS (NAT)
How to install WireGuard on an LXC NAT VPS?
First, connect to the server via SSH.
Installing the WireGuard server
1. First, update the package manager by entering the following commands (this may take a moment):
apt-get update && apt-get upgrade
2. Create a ‘clients’ folder, where we will store our clients’ configuration files, and navigate to it:
mkdir -p /home/wireguard && cd /home/wireguard
3. Run the command that will download the installation script and execute it directly:
wget -4 https://git.io/wireguard -O /home/wireguard/wireguard-install.sh && bash wireguard-install.sh
Installer options:
- This server is behind NAT. What is the public IPv4 address or hostname?
The primary IPv4 address will be detected automatically and will be displayed in square brackets; press Enter to continue - What port should WireGuard listen to?
You can find a list of available ports assigned to your server in the VPS control panel by going to the Network tab.
Select the first one on the list that supports UDP or is not already in use by another application on your server. - Enter a name for the first client
Enter your preferred name for the device you’ll be using to connect to WireGuard - Select a DNS server for the client
We recommend selecting 1, as it has DNS optimisation for the server - Should automatic updates be enabled for it?
Select Y (you will receive updates automatically)