Edit User Data Home ince.one Home

proxmox vpn lab
Uzaktan Evdeki Proxmox’a Bağlanmak İçin WireGuard Kullanımı
1️⃣ Amaç

Ev dışındayken, VPS üzerinden WireGuard VPN tüneli kullanarak evdeki Proxmox mini PC ve LAN’daki VM’lere güvenli bir şekilde bağlanmak.

---------------------------

# ???? Proxmox VPN Lab Kurulum Rehberi

## ???? SİSTEM ÖZETİ

### **Amaç:**
Ev dışındayken VPS üzerinden WireGuard VPN ile evdeki Proxmox sunucusuna ve LANdaki VMlere güvenli erişim.

### **Ağ Yapısı:**
- **VPS:** Public IP 85.214.57.19 - VPN Sunucusu
- **Proxmox:** LAN IP 192.168.11.200 - VPN Client
- **Windows:** VPN IP 10.40.0.10 - Uzaktan Erişim
- **VPN Subnet:** 10.40.0.0/24

---

## ???? ADIM ADIM KURULUM

### 1️⃣ **VPS KURULUMU (VPN Sunucusu)**

#### A) WireGuard Kurulumu
bash
# CentOS/RHEL
sudo yum install epel-release -y
sudo yum install wireguard-tools -y

# Ubuntu/Debian
sudo apt update
sudo apt install wireguard-tools -y


#### B) Key Üretimi
bash
cd /etc/wireguard
wg genkey | tee server_private.key | wg pubkey > server_public.key
chmod 600 server_private.key
cat server_public.key # Bu keyi kaydedin!


#### C) Config Dosyası (/etc/wireguard/wg0.conf)
ini
[Interface]
Address = 10.40.0.1/24
ListenPort = 51820
PrivateKey =
SaveConfig = true

# KRİTİK NAT KURALLARI
PostUp = iptables -t nat -A POSTROUTING -s 10.40.0.0/24 -o eth0 -j MASQUERADE
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -A FORWARD -o wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -s 10.40.0.0/24 -o eth0 -j MASQUERADE
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -D FORWARD -o wg0 -j ACCEPT

[Peer]
# Proxmox - SONRADAN EKLENECEK
PublicKey =
AllowedIPs = 10.40.0.2/32

[Peer]
# Windows - SONRADAN EKLENECEK
PublicKey =
AllowedIPs = 10.40.0.10/32


#### D) Firewall ve Sistem Ayarları
bash
# Port aç
sudo firewall-cmd --add-port=51820/udp --permanent

# IP forwarding ve NAT
sudo firewall-cmd --add-masquerade --permanent
sudo firewall-cmd --reload

# Kernel IP forwarding
echo net.ipv4.ip_forward=1 >> /etc/sysctl.conf
sysctl -p


#### E) Servisi Başlat
bash
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0


---

### 2️⃣ **PROXMOX KURULUMU (VPN Client)**

#### A) WireGuard Kurulumu
bash
sudo apt update
sudo apt install wireguard-tools -y


#### B) Key Üretimi
bash
cd /etc/wireguard
wg genkey | tee proxmox_private.key | wg pubkey > proxmox_public.key
chmod 600 proxmox_private.key
cat proxmox_public.key # Bu keyi VPSe ekleyeceğiz!


#### C) Config Dosyası (/etc/wireguard/wg0.conf)
ini
[Interface]
Address = 10.40.0.2/24
PrivateKey =

[Peer]
PublicKey =
Endpoint = 85.214.57.19:51820
AllowedIPs = 10.40.0.0/24
PersistentKeepalive = 25


#### D) Servisi Başlat
bash
sudo systemctl enable wg-quick@wg0
sudo systemctl start wg-quick@wg0


---

### 3️⃣ **WINDOWS KURULUMU (VPN Client)**

#### A) WireGuard İndirme
- https://www.wireguard.com/install/ adresinden indirin


#### B) Config Dosyası Oluşturma
ini
[Interface]
PrivateKey =
Address = 10.40.0.10/24
DNS = 8.8.8.8

[Peer]
PublicKey =
Endpoint = 85.214.57.19:51820
AllowedIPs = 10.40.0.0/24, 192.168.11.0/24
PersistentKeepalive = 25


#### C) Key Üretimi
- WireGuard uygulamasını açın
- Add empty tunnel → Otomatik key üretilecek
- Public keyi kopyalayıp VPSe ekleyin

---

### 4️⃣ **PEERLARI BİRLEŞTİRME**

#### A) Proxmox Public Keyi VPSe Ekle
bash
sudo wg set wg0 peer allowed-ips 10.40.0.2/32


#### B) Windows Public Keyi VPSe Ekle
bash
sudo wg set wg0 peer allowed-ips 10.40.0.10/32


#### C) VPSi Yeniden Başlat
bash
sudo wg-quick down wg0
sudo wg-quick up wg0


---

## ✅ TEST PROSEDÜRÜ

### 1. **Temel Bağlantı Testleri**
cmd
# Windowstan:
ping 10.40.0.1 # VPS VPN IP
ping 10.40.0.2 # Proxmox VPN IP
ping 192.168.11.200 # Proxmox LAN IP


### 2. **VPS Kontrolleri**
bash
sudo wg show # 2 peer görmeli
ip route # Routing kontrolü
sudo tcpdump -i wg0 -n # Trafik izleme


### 3. **Proxmox Kontrolleri**
bash
sudo wg show
ping 10.40.0.1 # VPSe ping
ping 10.40.0.10 # Windowsa ping


---

## ????️ SORUN GİDERME

### **Sık Karşılaşılan Sorunlar:**

1. **Destination unreachable**
bash
# VPSde IP forwarding kontrolü:
cat /proc/sys/net/ipv4/ip_forward # 1 olmalı


2. **Peer bağlanmıyor**
bash
sudo wg show # Peerları kontrol et


3. **Windows LANa erişemiyor**
cmd
# Manuel route ekle:
route add 192.168.11.0 mask 255.255.255.0 10.40.0.1


4. **Proxmox firewall engelliyor**
bash
pve-firewall stop # Test için geçici kapat


---

## ???? BAŞARI KRİTERLERİ

- ✅ Windows → VPS VPN IP: ping 10.40.0.1
- ✅ Windows → Proxmox VPN IP: ping 10.40.0.2
- ✅ Windows → Proxmox LAN IP: ping 192.168.11.200
- ✅ Proxmox web arayüzü: https://192.168.11.200:8006
- ✅ SSH erişimi: ssh root@192.168.11.200

---

## ???? ÖNEMLİ NOTLAR

1. **Tüm keyler doğru ve eşleşmeli**
2. **VPSde NAT kuralları kritik önemde**
3. **Firewall port 51820/udp açık olmalı**
4. **IP forwarding aktif olmalı**
5. **PersistentKeepalive NAT arkasındaki cihazlar için gerekli**

Edit Delete