Wireguard VPN Linux Server and Windows Client Setup (NEW, 100% Works, 2024)!

Опубликовано: 07 Октябрь 2024
на канале: IT Solutions
1,132
5

Please subscribe and help boost the channel ‪@itsolutions5098‬ !

Linux Ubuntu Focal 20.04 Server Setup

apt update && apt upgrade -y

cd /etc/ sysctl.conf

sysctl -p

apt install wireguard -y

apt install wireguard resolvconf -y

wg genkey | tee privatekey | wg pubkey(put angle bracket between) publickey

cat privatekey

cat publickey

touch wg0.conf

nano wg0.conf

The Config File

[Interface]
PrivateKey = Linux Server Key
Address = 10.0.0.1/24 - You can put any local IP Range
ListenPort = 51820
DNS = 185.12.64.1, 185.12.64.2
PostUp = sysctl net.ipv4.ip_forward=1
PostUp = iptables -A FORWARD -i eth0 -o wg0 -j ACCEPT
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = sysctl net.ipv4.ip_forward=0
PostDown = iptables -D FORWARD -i eth0 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

[Peer]
PublicKey = WIndows Client Key
AllowedIPs = IP Address

chmod 600 wg0.conf

chmod 600 privatekey

sudo systemctl start wg-quick@wg0

sudo systemctl enable wg-quick@wg0

sudo systemctl status wg-quick@wg0

sudo systemctl restart wg-quick@wg0

wg

sudo ufw status

sudo ufw enable

sudo ufw allow 51820/udp

sudo ufw allow 22/tcp

sudo ufw reload

sudo ufw status

Windows Device Setup

[Interface]
PrivateKey = WireGuard Client Key
Address = IP Address
DNS = DNS Server

[Peer]
PublicKey = Linux Server KEY
AllowedIPs = IP Range
Endpoint = Your Public IP:51820