WireGuard Site-to-Site VPN dengan Ruijie EG209GS: Setup, PBR, dan Troubleshooting
Panduan lengkap setup WireGuard site-to-site VPN menghubungkan dua LAN kantor via VPS hub menggunakan router Ruijie EG209GS, lengkap dengan konfigurasi PBR dan tips troubleshooting.
Di artikel ini gw bakal sharing pengalaman setup WireGuard site-to-site VPN menghubungkan dua lokasi kantor menggunakan router Ruijie EG209GS dengan VPS sebagai hub. Setup ini cocok buat kamu yang punya beberapa cabang dan mau bikin semua LAN-nya bisa saling komunikasi lewat tunnel yang aman dan ringan.
Topologi Jaringan
Berikut gambaran topologi yang digunakan:
[Site A - 192.168.10.0/24] [VPS - Hub] [Site B - 192.168.9.0/24]
Ruijie EG209GS 10.0.0.1/24 Ruijie EG209GS
wg IP: 10.0.0.100 <===WireGuard tunnel===> wg IP: 10.0.0.101
- VPS sebagai WireGuard server/hub dengan IP tunnel
10.0.0.1/24 - Site A (Ruijie #1): LAN
192.168.10.0/24, WG peer10.0.0.100 - Site B (Ruijie #2): LAN
192.168.9.0/24, WG peer10.0.0.101
Persiapan
- VPS dengan akses root (Ubuntu/Debian/Alpine)
- 2x Ruijie EG209GS (firmware terbaru yang support WireGuard)
- Port UDP yang dibuka di firewall VPS (default
51820)
Step 1: Setup WireGuard di VPS
Install WireGuard di VPS:
apt install wireguard -y
Generate keypair untuk VPS:
wg genkey | tee /etc/wireguard/server_private.key | wg pubkey > /etc/wireguard/server_public.key
Buat config /etc/wireguard/wg0.conf:
[Interface]
Address = 10.0.0.1/24
ListenPort = 51820
PrivateKey = <SERVER_PRIVATE_KEY>
PostUp = iptables -t nat -I POSTROUTING 1 -s 10.0.0.0/24 -o eth0 -j MASQUERADE
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT
PostUp = iptables -A FORWARD -o wg0 -j ACCEPT
PreDown = iptables -t nat -D POSTROUTING -s 10.0.0.0/24 -o eth0 -j MASQUERADE
PreDown = iptables -D FORWARD -i wg0 -j ACCEPT
PreDown = iptables -D FORWARD -o wg0 -j ACCEPT
[Peer]
# Site A - Ruijie EG209GS
PublicKey = <SITE_A_PUBLIC_KEY>
AllowedIPs = 10.0.0.100/32, 192.168.10.0/24
[Peer]
# Site B - Ruijie EG209GS
PublicKey = <SITE_B_PUBLIC_KEY>
AllowedIPs = 10.0.0.101/32, 192.168.9.0/24
Aktifkan IP forwarding dan start WireGuard:
# Enable IP forwarding
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
sysctl -p
# Start WireGuard
systemctl enable --now wg-quick@wg0
Step 2: Konfigurasi WireGuard di Ruijie EG209GS
Login ke Ruijie Admin Panel → VPN → WireGuard, tambahkan policy baru:
Site A (192.168.10.0/24)
- Policy Name: Site_A
- Interface IP:
10.0.0.100/32 - Bound Interface: WAN
- DNS:
9.9.9.9 - Accessible IP Range: Custom
192.168.9.0/24(subnet site lawan)10.0.0.0/24(subnet tunnel)
Server Config (Peer VPS):
- Server IP: IP publik VPS
- Server Port:
51820 - Server Public Key: public key VPS
Lakukan hal yang sama untuk Site B dengan IP tunnel 10.0.0.101/32 dan Accessible IP Range 192.168.10.0/24.
Step 3: Setup PBR (Policy Based Routing) di Ruijie
Ini bagian yang paling krusial dan sering bikin bingung. Tanpa PBR, traffic cross-site tidak akan diarahkan lewat tunnel WireGuard.
Masuk ke Advanced → Routing → PBR, tambahkan rule:
- Name: Cross_Site_A
- Protocol: IP
- Src IP:
192.168.10.0 - 192.168.10.255(LAN lokal) - Dst IP:
192.168.9.0 - 192.168.9.255(LAN site lawan) ← pastikan tidak typo! - Outbound Interface: WireGuard interface
⚠️ Jangan set Dst IP ke 192.168.0.0 - 192.168.255.255 karena akan nge-route semua traffic 192.168.x.x lewat tunnel termasuk traffic LAN lokal sendiri.Troubleshooting
Gateway bisa di-ping tapi host tidak bisa
Cek PBR — kemungkinan Dst IP salah atau Accessible IP Range di WireGuard client belum include subnet tunnel (10.0.0.0/24). Source IP dari laptop yang konek via WireGuard adalah IP tunnel (10.0.0.x), jadi reply dari host harus tau cara balik lewat tunnel.
Debug dengan tcpdump di VPS
# Lihat traffic ICMP di interface WireGuard
tcpdump -i wg0 -n icmp
# Kalau request masuk tapi tidak ada reply → masalah di sisi penerima (PBR/firewall)
# Kalau request tidak masuk sama sekali → masalah di sisi pengirim (AllowedIPs/routing)
Cek status WireGuard
wg show
# Lihat "latest handshake" — kalau lebih dari beberapa menit, peer belum konek
Verifikasi
Setelah semua terkonfigurasi, test dari router Ruijie via Diagnostics → Network Tools → Ping:
- Ping dari Site A ke
192.168.9.1→ harus reply ✅ - Ping dari Site B ke
192.168.10.1→ harus reply ✅ - Ping cross-host antar subnet → harus reply ✅
Kesimpulan
WireGuard site-to-site dengan Ruijie EG209GS sebenarnya straightforward, tapi ada beberapa gotcha yang perlu diperhatikan:
- AllowedIPs di VPS harus include subnet LAN masing-masing site
- Accessible IP Range di Ruijie harus include subnet tunnel
10.0.0.0/24dan subnet site lawan - PBR harus dikonfigurasi dengan Dst IP yang spesifik, bukan broad range
- Selalu debug dengan
tcpdumpdi VPS untuk tau paket putus di titik mana
Semoga artikel ini membantu! Kalau ada pertanyaan drop di kolom komentar ya. 🚀