WireGuard Server in Debian

WireGuard: A Normal VPN Server replacing OpenVPN etc.

There is also another option to setup normal VPN Server, I choose WireGuard as an example

1. Install Wireguard

Update Debian first

sudo -i
apt-get update && apt-get upgrade -y

Install cloud-amd64 linux header

apt install linux-headers-$(uname -r) -y

reboot once

reboot

Enable package forward

nano /etc/sysctl.conf

find #net.ipv4.ip_forward=1 and delete the # in front

Activate changes then install wireguard

Case: If there is error showing E: unable to locate package wireguard

2. Configure wireguard server

Generate key pairs (privatekey=server private key, publickey= server public key, priclikey=private client key, pubclikey=public server key)

Copy the following result of keys

Check the interface name of VPS (there should be 2, one name as "lo", we need another one) For example: en0

Edit config file (note: eth0 should change to the name you find in previous step, in my case is en0)

Activate the server

Open UDP port : 51820 in VPS firewall

3. Generate QR code for mobile use

Install QR Code Generator (For desktop users, you can skip installing, just change the config file below)

Setup the config file for mobile device

Things to change: PrivateKey, PublicKey, PresharedKey, a.bname.com You may type your setting in mobile directly if you want, but I'm lazy For DNS, if you created DNS server in the same Debian server, you can change to 192.168.69.1

Generate QR code for mobile use

Last updated

Was this helpful?