Site-to-Site VPN einfach mit WireGuard einrichten! Schritt-für-Schritt Anleitung

In diesem Video zeige Ich euch, wie ihr in wenigen Schritten euere eigene Site-to-Site VPN mit Hilfe von WireGuard einrichten könnt. Hierbei spielt es keine Rolle welchen Router bzw. welche Firewall ihr nutzt.

» AWOW miniPC als VPN-Server: https://amzn.to/3FHjmVR
» DynDNS einrichten: https://cc.apfelcast.com/8738z
» WireGuard Playlist: https://cc.apfelcast.com/udgzo

Im Video verwendete Befehle:

######## Create WireGuard Site-to-Site VPN ######## 

example data:
subnet site-1: 192.168.0.0/24
subnet site-2: 192.168.178.0/24



--> on site 1 and 2
## install WireGuard ##
apt install wireguard

## enbale ip forwarding ##
nano /etc/sysctl.conf

uncomment net.ipv4.ip_forward=1

## apply changes ##
sysctl -p

## generate public and private keys ##
cd /etc/wireguard
umask 077; wg genkey | tee privatekey | wg pubkey > publickey

--> site 1 (server)

## create wg0.conf

nano /etc/wireguard/wg0.conf

[Interface] 
PrivateKey = <site-1 private-key>
Address = 10.0.0.1/24
SaveConfig = true 
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
ListenPort = 51820

[Peer]
PublicKey = <site-2 public-key>
AllowedIPs = 10.0.0.0/24, 192.168.178.0/24
PersistentKeepalive = 25

--> site 2 (client)

## create wg0.conf

[Interface] 
PrivateKey = <site-2 private-key>
Address = 10.0.0.3/24
SaveConfig = true 
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 = <site-1 public-key>
Endpoint = <FQDN>:51820 
AllowedIPs = 10.0.0.0/24, 192.168.0.0/24
PersistentKeepalive = 25

--> on site 1 and 2

## start connection ##
wg-quick up wg0

## show status ##
wg show

## enable on system boot ##
systemctl enable wg-quick@wg0

apfelcast Support

Du benötigst Unterstützung bei deinem Projekt oder hast Fragen zur Umsetzung?
Dann melde ich gern bei uns!

Ähnliche Beiträge