Una VPN WireGuard personale significa server, chiavi e log tutti tuoi. Questa è la guida di config manuale; per i compromessi rispetto alle VPN commerciali, la via wg-easy a un comando e l'avvertenza sul DPI, vedi self-host WireGuard e il caso d'uso VPS per VPN. Ti serve un piano a IP dedicato — WireGuard ascolta su una porta UDP in ingresso.
1. Installa WireGuard e crea le chiavi del server
apt update && apt install -y wireguard
wg genkey | tee /etc/wireguard/server.key | wg pubkey > /etc/wireguard/server.pub
chmod 600 /etc/wireguard/server.key
2. Scrivi la config del server
# /etc/wireguard/wg0.conf
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = <contents of /etc/wireguard/server.key>
PostUp = iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer] # your phone/laptop
PublicKey = <client public key — see step 4>
AllowedIPs = 10.8.0.2/32
3. Abilita il forwarding e avvialo
sysctl -w net.ipv4.ip_forward=1
echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
ufw allow 51820/udp
systemctl enable --now wg-quick@wg0
wg show
4. Genera una chiave client e connettiti
Sul client (o genera sul server e spostala):
wg genkey | tee client.key | wg pubkey > client.pub
Metti client.pub nel blocco [Peer] qui sopra (poi systemctl restart wg-quick@wg0) e dai al client questa config:
[Interface]
PrivateKey = <client.key>
Address = 10.8.0.2/32
DNS = 1.1.1.1
[Peer]
PublicKey = <server.pub>
Endpoint = YOUR.SERVER.IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Importala nell'app WireGuard (un QR via qrencode -t ansiutf8 < client.conf è il più rapido su mobile), attiva — e stai instradando attraverso il tuo server.
Note
- Dietro un DPI (Iran/Cina/Russia)? WireGuard viene identificato e bloccato — usa invece VLESS + Reality.
- Preferisci una UI web? La via wg-easy a un comando configura questo con un pannello di amministrazione a QR-code.
Nano-IP (8 $/mese) è più che sufficiente, traffico non misurato, root in circa un minuto, niente KYC, pagamento in cripto.
Commenti
Ancora nessun commento. Sii il primo.