Set Up Your Own Wireguard VPN Server on Ubuntu 22.04
In this video, we have an exciting tutorial where we'll be setting up WireGuard VPN on Ubuntu 22.04, step by step. WireGuard is a modern, fast, and secure VPN protocol. Setting it up on Ubuntu is relatively straightforward, and I'll guide you through the process.
Get Contabo VPS
https://tinyurl.com/4dv3xsxw
Get DigitalOcean VPS
https://zacs-tech.com/go/digitalocean/
Get Vultr VPS
https://zacs-tech.com/go/vultr/
Register domain name
https://tinyurl.com/y8hz9seu
Get the training and certification you need! Linux Foundation, IT training
https://tinyurl.com/3pwv3czu
Commands
sudo nano /etc/sysctl.conf
sudo sysctl -p
sudo apt install wireguard
wg genkey | sudo tee /etc/wireguard/server_private.key | wg pubkey | sudo tee /etc/wireguard/server_public.key
sudo nano /etc/wireguard/wg0.conf
----------------------------------------------------------------------------------
[Interface]
## Private IP address for the wg0 interface ##
Address = 10.0.0.1/24
## VPN server listening port ##
ListenPort = 51820
## VPN server private key ##
PrivateKey = ncjecndiuvndeivenokdmcdpo0dockecok
## Firewall rules ##
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp1s0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o enp1s0 -j MASQUERAD
-------------------------------------------------------------------------------------------------------------
ip -o -4 route show to default | awk '{print $5}'
sudo chmod -R 600 /etc/wireguard/
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0
sudo systemctl status wg-quick@wg0.service
wg genkey | sudo tee /etc/wireguard/client_private.key | wg pubkey | sudo tee /etc/wireguard/client_public.key
sudo nano /etc/wireguard/wg0.conf
-----------------------------------------------------------------------------------------------------------------------
[Interface]
## VPN client private IP address ##
Address = 10.0.0.2/24
## VPN client private key ##
PrivateKey = 0COkq1GMM86CmlF5blPFDYhU84iTX8iJ7lWoC1gLfnk=
[Peer]
## VPN server public key ##
PublicKey = Znnnnnmjiio
## VPN server public IP address and port ##
Endpoint = 192.168.122.101:51820
## Route all the traffic through the VPN tunnel ##
AllowedIPs = 0.0.0.0/0
## Key connection alive ##
PersistentKeepalive = 15
------------------------------------------------------------------------------------------------------------
[Peer]
## Client public key ##
PublicKey = 6mmmmmmm
## Client IP address ##
AllowedIPs = 10.0.0.2/24
-------------------------------------------------------------------------------------------------------
sudo systemctl restart wg-quick@wg0.service
sudo systemctl start wg-quick@wg0
DISCLAIMER: This video and description contain affiliate links, which means that if you click on one of the product links, I’ll receive a small commission. This helps support the channel and allows us to continue to make videos like this. Thank you for your support!