$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">update
$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install wireguard -y
$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install wireguard -y
$ -weight: 600;">sudo -weight: 500;">apt -weight: 500;">install wireguard -y
$ wg genkey | -weight: 600;">sudo tee /etc/wireguard/server_private.key
$ -weight: 600;">sudo chmod 600 /etc/wireguard/server_private.key
$ wg genkey | -weight: 600;">sudo tee /etc/wireguard/server_private.key
$ -weight: 600;">sudo chmod 600 /etc/wireguard/server_private.key
$ wg genkey | -weight: 600;">sudo tee /etc/wireguard/server_private.key
$ -weight: 600;">sudo chmod 600 /etc/wireguard/server_private.key
$ -weight: 600;">sudo cat /etc/wireguard/server_private.key | wg pubkey | -weight: 600;">sudo tee /etc/wireguard/server_public.key
$ -weight: 600;">sudo cat /etc/wireguard/server_private.key | wg pubkey | -weight: 600;">sudo tee /etc/wireguard/server_public.key
$ -weight: 600;">sudo cat /etc/wireguard/server_private.key | wg pubkey | -weight: 600;">sudo tee /etc/wireguard/server_public.key
$ ip route | grep default
$ ip route | grep default
$ ip route | grep default
$ -weight: 600;">sudo nano /etc/wireguard/wg0.conf
$ -weight: 600;">sudo nano /etc/wireguard/wg0.conf
$ -weight: 600;">sudo nano /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <paste server private key here>
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <paste server private key here>
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <paste server private key here>
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
$ wg genkey | tee client_private.key
$ cat client_private.key | wg pubkey | tee client_public.key
$ wg genkey | tee client_private.key
$ cat client_private.key | wg pubkey | tee client_public.key
$ wg genkey | tee client_private.key
$ cat client_private.key | wg pubkey | tee client_public.key
$ -weight: 600;">sudo cat /etc/wireguard/server_public.key
$ -weight: 600;">sudo cat /etc/wireguard/server_public.key
$ -weight: 600;">sudo cat /etc/wireguard/server_public.key
$ nano client.conf
$ nano client.conf
$ nano client.conf
[Interface]
Address = 10.0.0.2/32
PrivateKey = <client private key>
DNS = 8.8.8.8 [Peer]
PublicKey = <server public key>
Endpoint = YOUR-SERVER-IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
[Interface]
Address = 10.0.0.2/32
PrivateKey = <client private key>
DNS = 8.8.8.8 [Peer]
PublicKey = <server public key>
Endpoint = YOUR-SERVER-IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
[Interface]
Address = 10.0.0.2/32
PrivateKey = <client private key>
DNS = 8.8.8.8 [Peer]
PublicKey = <server public key>
Endpoint = YOUR-SERVER-IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
[Peer]
PublicKey = <client public key>
AllowedIPs = 10.0.0.2/32
[Peer]
PublicKey = <client public key>
AllowedIPs = 10.0.0.2/32
[Peer]
PublicKey = <client public key>
AllowedIPs = 10.0.0.2/32
$ echo "net.ipv4.ip_forward=1" | -weight: 600;">sudo tee -a /etc/sysctl.conf
$ -weight: 600;">sudo sysctl -p
$ echo "net.ipv4.ip_forward=1" | -weight: 600;">sudo tee -a /etc/sysctl.conf
$ -weight: 600;">sudo sysctl -p
$ echo "net.ipv4.ip_forward=1" | -weight: 600;">sudo tee -a /etc/sysctl.conf
$ -weight: 600;">sudo sysctl -p
$ -weight: 600;">sudo ufw allow 51820/udp
$ -weight: 600;">sudo ufw allow 51820/udp
$ -weight: 600;">sudo ufw allow 51820/udp
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">enable wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">start wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status wg-quick@wg0
$ -weight: 600;">sudo -weight: 500;">systemctl -weight: 500;">status wg-quick@wg0
$ -weight: 600;">sudo wg show
$ -weight: 600;">sudo wg show
$ -weight: 600;">sudo wg show
$ scp client.conf user@your-local-machine:~/
$ scp client.conf user@your-local-machine:~/
$ scp client.conf user@your-local-machine:~/
$ ping 10.0.0.1
$ ping 10.0.0.1
$ ping 10.0.0.1 - Linux: -weight: 600;">sudo wg-quick up ~/client.conf
- Windows / macOS / iOS / Android: Install the WireGuard app and import client.conf - Add more clients by generating additional key pairs and adding new [Peer] blocks to wg0.conf
- Restrict each client to specific subnets by adjusting AllowedIPs per peer
- Reload the configuration without restarting using -weight: 600;">sudo wg syncconf wg0 <(-weight: 600;">sudo wg-quick strip wg0)