Set Up Your Own Wireguard VPN Server on Ubuntu 22.04

ZacsTech
ZacsTech
17.1 هزار بار بازدید - 9 ماه پیش - In this video, we have
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 Kamatera VPS (30 days free trial)
https://zacs-tech.com/go/kamatera-vps/

Get RedHosting VPS
https://zacs-tech.com/go/rosehosting/

Get InterServer VPS
https://zacs-tech.com/go/interserver/

Get Hawk Host VPS
https://zacs-tech.com/go/hawkhost/

Register domain name
https://tinyurl.com/y8hz9seu

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 [email protected]

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 [email protected]

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!
9 ماه پیش در تاریخ 1402/08/21 منتشر شده است.
17,108 بـار بازدید شده
... بیشتر