Aplica-se a: LifeinCloud Cloud VPS • Ubuntu 22.04 LTS

Visão geral

O WireGuard é um protocolo VPN rápido e moderno, simples de configurar. A LifeinCloud oferece uma imagem WireGuard com 1 clique, mas aqui está como configurá-lo manualmente.

Requisitos

  • VPS LifeinCloud a correr Ubuntu 22.04.
  • Acesso root via SSH.

Passo 1 — Atualizar o VPS

ssh root@O_SEU_SERVIDOR_IP
apt update && apt upgrade -y

Passo 2 — Instalar o WireGuard

apt install -y wireguard qrencode

Passo 3 — Gerar chaves

umask 077
wg genkey | tee /etc/wireguard/privatekey | wg pubkey > /etc/wireguard/publickey

Passo 4 — Criar ficheiro de configuração

nano /etc/wireguard/wg0.conf
[Interface]
Address = 10.0.0.1/24
PrivateKey = (conteúdo de /etc/wireguard/privatekey)
ListenPort = 51820
SaveConfig = true

[Peer]
PublicKey = CLIENT_PUBLIC_KEY
AllowedIPs = 10.0.0.2/32

Passo 5 — Ativar e iniciar o WireGuard

systemctl enable wg-quick@wg0
systemctl start wg-quick@wg0

Passo 6 — Regras de firewall

ufw allow 51820/udp
Nota: Para evitar a configuração manual, utilize a imagem WireGuard VPN com 1 clique no painel da LifeinCloud.
Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)