Set Up Your Own Wireguard VPN Server on Ubuntu 24.04
Looking to set up a secure, speedy VPN? This video guides you through the process of configuring a WireGuard VPN on Ubuntu 24.04, showing you how to create a secure connection. This modern VPN protocol is known for its speed and simplicity, making it a great choice for enhancing your internet privacy.
👉 Sign up for DigitalOcean - https://zacs-tech.com/go/digitalocean/
👉 Register a domain name
https://tinyurl.com/y8hz9seu
👉 Get Kamatera VPS (30 days free trial)
https://zacs-tech.com/go/kamatera-vps/
👉 Sign up for Hostinger Web and Cloud hosting plans for projects of any scale.
https://zacs-tech.com/go/hostinger/
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!