Como Configurar WireGuard VPN num VPS Sueco
Execute o Seu Próprio Servidor VPN com WireGuard
Em vez de pagar por um serviço VPN comercial, execute o seu próprio servidor WireGuard num VPS. Obtém controlo total, sem registos de terceiros e um endereço IP sueco dedicado.
O Que Precisa
- Um VPS com Linux — KVM VPS 1G (€6/mês) é suficiente
- Acesso root (SSH)
- 10 minutos do seu tempo
Passo 1: Conectar ao Seu VPS
ssh root@your-server-ip
Passo 2: Instalar WireGuard
Debian/Ubuntu
apt update && apt install -y wireguard
Rocky Linux/AlmaLinux
dnf install -y epel-release && dnf install -y wireguard-tools
Passo 3: Gerar Chaves
wg genkey | tee /etc/wireguard/server_private.key | wg pubkey > /etc/wireguard/server_public.key
chmod 600 /etc/wireguard/server_private.key
wg genkey | tee /etc/wireguard/client_private.key | wg pubkey > /etc/wireguard/client_public.key
Passo 4: Configuração do Servidor
cat > /etc/wireguard/wg0.conf << EOF
[Interface]
PrivateKey = $(cat /etc/wireguard/server_private.key)
Address = 10.0.0.1/24
ListenPort = 51820
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
[Peer]
PublicKey = $(cat /etc/wireguard/client_public.key)
AllowedIPs = 10.0.0.2/32
EOF
Passo 5: Ativar Encaminhamento IP
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
Passo 6: Iniciar WireGuard
systemctl enable --now wg-quick@wg0
Passo 7: Configuração do Cliente
Crie client.conf:
[Interface]
PrivateKey = CLIENT_PRIVATE_KEY
Address = 10.0.0.2/24
DNS = 1.1.1.1
[Peer]
PublicKey = SERVER_PUBLIC_KEY
Endpoint = YOUR_SERVER_IP:51820
AllowedIPs = 0.0.0.0/0
PersistentKeepalive = 25
Substitua os valores placeholder pelas suas chaves reais e IP do servidor.
Passo 8: Conectar
Importe o ficheiro de configuração na app WireGuard no seu dispositivo:
- Windows/macOS/Linux: wireguard.com/install
- iOS: App Store → WireGuard
- Android: Play Store → WireGuard
Verificar
curl ifconfig.me
O seu IP deve agora mostrar o endereço IP sueco do seu servidor VPS.
Porquê o Seu Próprio VPN É Melhor
| VPN Auto-alojado | VPN Comercial | |
|---|---|---|
| Custo | €6/mês | €5-10/mês |
| Endereço IP | Dedicado (só seu) | Partilhado com milhares |
| Registos | Você controla | Confie no fornecedor |
| Dispositivos | Ilimitados | Normalmente 5-6 |
| Bloqueado por serviços | Raramente | Frequentemente |
| Velocidade | Largura de banda total do VPS | Variável |
Planos VPS Recomendados
| Plano | RAM | Disco | Preço | Capacidade |
|---|---|---|---|---|
| KVM VPS 1G | 1 GB | 15 GB SSD | €6/mês | 5-10 dispositivos |
| KVM VPS 2G | 2 GB | 20 GB SSD | €10/mês | 20+ dispositivos |