WireGuard modern, hafif ve hızlı bir VPN'dir. Bir HolyCloud Linux VPS'inde SSH'ye, veritabanlarına veya panellere bunları herkese açmadan ulaşmanızı sağlar; yalnızca WireGuard UDP portu açık kalır.
Ön koşullar
- Ubuntu/Debian HolyCloud VPS, güncel çekirdek (WireGuard dahildir)
- sudo erişimi
- UFW ve HolyCloud güvenlik duvarında açık, seçilmiş bir UDP portu (ör. 51820)
- İstemciler: Windows, macOS, Linux, iOS, Android (WireGuard uygulaması)
Adım 1: kurulum
sudo apt update
sudo apt install -y wireguard qrencode
Adım 2: sunucu anahtarları
umask 077
wg genkey | tee /etc/wireguard/server_private.key | wg pubkey > /etc/wireguard/server_public.key
sudo chmod 600 /etc/wireguard/server_private.key
Adım 3: sunucu yapılandırması
sudo nano /etc/wireguard/wg0.conf
[Interface]
Address = 10.8.0.1/24
ListenPort = 51820
PrivateKey = CONTENU_DE_server_private.key
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE
[Peer]
# Client 1 — laptop
PublicKey = CLE_PUBLIQUE_CLIENT
AllowedIPs = 10.8.0.2/32
eth0 yerine genel arayüzü yazın (ip -o -4 route show to default | awk '{print $5}').
İstemci anahtarlarını oluşturun:
wg genkey | tee client1_private.key | wg pubkey > client1_public.key
Adım 4: IP iletme ve güvenlik duvarı
echo 'net.ipv4.ip_forward=1' | sudo tee /etc/sysctl.d/99-wireguard.conf
sudo sysctl --system
sudo ufw allow 51820/udp comment 'WireGuard'
sudo systemctl enable --now wg-quick@wg0
Adım 5: istemci yapılandırması (örnek)
WireGuard uygulamasına aktarılacak client1.conf dosyası:
[Interface]
PrivateKey = CLE_PRIVEE_CLIENT
Address = 10.8.0.2/24
DNS = 1.1.1.1
[Peer]
PublicKey = CLE_PUBLIQUE_SERVEUR
Endpoint = IP_PUBLIQUE_VPS_HOLYCLOUD:51820
AllowedIPs = 10.8.0.0/24
PersistentKeepalive = 25
QR kodu (mobil):
qrencode -t ansiutf8 < client1.conf
Tüm İnternet trafiğini VPS üzerinden yönlendirmek için AllowedIPs = 0.0.0.0/0, ::/0 kullanın (yasal sorumluluk ve ağ yükü size aittir).
Doğrulama
sudo wg show
ping -c 3 10.8.0.2
İstemci tarafı: tünel « active », 10.8.0.1 adresine ping, VPN IP'si üzerinden SSH:
ssh [email protected]
HolyCloud yardımı
- Handshake yok: UDP 51820'yi (UFW + müşteri alanı),
Endpointdeğerini ve açık anahtarları kontrol edin - Tünel üzerinden İnternet yok:
ip_forward,MASQUERADEkuralları, doğru ağ arayüzü - HolyCloud destek ekibi:
sudo wg show, varsayılan arayüz,journalctl -u wg-quick@wg0