Hallo zusammen,
ich bin neu hier und muss um Hilfe bitten, da ich mit den Videos nicht weiterkomme
Ich habe folgende Idee und Setup dazu:
Über das wg0 Interface möchte ich den Traffic an mein NAS leiten, bzw. auch an den Router. Dazu wird noch eine Verbindung benötigt zum PC, da dieser nur über den WG-Tunnel über SSH drauf soll, der Port 22 ist im IONOS VPS Hosting nach außen hin gesperrt.
Nun möchte ich ein zweites WireGuard laufen lassen, welches keinen Zugriff auf die Geräte vom wg0 hat, sondern nur auf gewisse Proxmox LXCs, welche auch über die public IPv4 des Servers im Internet erreichbar sein sollen.
Ich habe folgende Configs
wg0 Server:
[Interface]
Address = 10.0.0.1/24
ListenPort = 62000
PrivateKey = <PrivateKey>
PostUp = iptables -A FORWARD -i wg0 -o ens6 -j ACCEPT
PostUp = iptables -A FORWARD -i ens6 -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT
PostDown = iptables -A FORWARD -i wg0 -o ens6 -j ACCEPT
PostDown = iptables -A FORWARD -i ens6 -o wg0 -m state --state RELATED,ESTABLISHED -j ACCEPT
# WireGuard@Home
[Peer]
PublicKey = <PublicKey>
PresharedKey = <PresharedKey>
AllowedIPs = 10.0.0.2/32, 172.16.1.1, 172.16.1.5/32, 172.16.1.10/32
PersistentKeepalive = 25
# Peer 2ff.
[Peer]
PublicKey = <PublicKey>
PresharedKey = <PresharedKey>
AllowedIPs = 10.0.0.3/32
PersistentKeepalive = 25
Dazu die Config der ganzen Peers (Das Schema ist immer gleich nur die keys sind andere):
[Interface]
Address = 10.0.0.2/32
PrivateKey = YEbyBkGD7+pZuwexZ2mJIx+j5SZauyoDgE2wCOibpVU=
[Peer]
PublicKey = <PublicKey>
PresharedKey = <PresharedKey>
AllowedIPs = 10.0.0.0/24, 172.16.1.0/24
Endpoint = <PublicIP>:62000
PersistentKeepalive = 25
Nun habe ich noch das Interface wg1 auf dem VPS:
[Interface]
Address = 10.10.0.1/24
ListenPort = 62001
PrivateKey = <PrivateKey>
PostUp = iptables -t nat -A PREROUTING -i ens6 -p tcp -m multiport --dport 80,443 -j DNAT --to-destination 10.10.0.2
PostUp = iptables -t nat -A POSTROUTING -o wg1 -p tcp -m multiport --dport 80,443 -d 10.0.0.2 -j SNAT --to-source 10.0.0.1
PostUp = iptables -A FORWARD -i ens6 -o wg1 -p tcp -m multiport --dport 80,443 -j ACCEPT
PostUp = iptables -A FORWARD -m conntrack --cstate ESTABLISHED,RELATED -j ACCEPT
PostDown = iptables -t nat -A PREROUTING -i ens6 -p tcp -m multiport --dport 80,443 -j DNAT --to-destination 10.10.0.2
PostDown = iptables -t nat -A POSTROUTING -o wg1 -p tcp -m multiport --dport 80,443 -d 10.0.0.2 -j SNAT --to-source 10.0.0.1
PostDown = iptables -A FORWARD -i ens6 -o wg1 -p tcp -m multiport --dport 80,443 -j ACCEPT
PostDown = iptables -A FORWARD -m conntrack --cstate ESTABLISHED,RELATED -j ACCEPT
[Peer]
PublicKey = <PublicKey>
PresharedKey = <PresharedKey>
AllowedIPs = 10.10.0.2/32
PersistentKeepalive = 25
Und die dazugehörige Client conf für wg1
[Interface]
Address = 10.10.0.2/24
PrivateKey = <PrivateKey>
[Peer]
PublicKey = <PublicKey>
PresharedKey = <PresharedKey>
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = <PublicIP>:62001
Lasse ich jetzt wg0 laufen, kriege ich mit beispielsweise meinem Smartphone eine Verbindung zum wg0 hin. Das Handshake kommt und die Verbindung ist „da“ (also Bytes empfangen). Aber ich kann aber keine Verbindung zur 172.16.1.5 herstellen. Genauso komme ich nicht von meinem PC aud den 10.0.0.1 wg0 Interface über SSH, eine statische Route in der Fritz!Box ist eingetragen.
Verbindung zum wg1 funktioniert auch nicht sauber, das ist der Output von „wg show“
interface: wg1
public key: <PublicKey>
private key: (hidden)
listening port: 60396
fwmark: 0xca6d
peer: <PrivateKey>
preshared key: (hidden)
endpoint: <PublicIP>:62001
allowed ips: 0.0.0.0/0, ::/0
transfer: 0 B received, 296 B sent <<< Hier kommt nichts auf wg1
Ich habe das Gefühl, dass ich etwas vergessen habe, ich weiß aber nicht was. Hat jemand eine Idee, was hier in der Config fehlt?
Gruß
Xiao