
Ich versuche, über ein WireGuard-VPS-Setup auf meine LAN-Geräte zuzugreifen. Ich habe 2 WireGuard-Peers, die mit einem WireGuard-Server verbunden sind, der eine öffentliche IP auf AWS EC2 mit Ubuntu hat. Ich bin neu bei WireGuard und auch ein Netzwerk-Neuling, aber das ist, was ich bisher zum Laufen gebracht habe.
Dies ist das Setup, das ich verwende: Netzwerkeinrichtung
ping 10.66.66.1 works from A
ping 10.66.66.2 works from A
ping 10.66.66.1 works from B
ping 10.66.66.3 works from B
Das Problem tritt auf, wenn ich versuche, von A aus das LAN hinter R3 anzupingen.
ping 192.168.102.10 results in timed out.
tracert 192.168.102.10 shows the first hop to 10.66.66.1.
All subsequent hops are * * * and trace never completes.
Ähnliche Probleme treten auf, wenn ich versuche, 192.168.103.10 von B aus anzupingen. Der einzige Unterschied auf dieser Seite besteht darin, dass ich auf R3 eine statische Route für die Ziele 192.168.103.0/24 konfiguriert habe, die über 10.66.66.2 verlaufen soll.
Außerdem müssen wir davon ausgehen, dass ich in keiner Weise Zugriff auf die Konfigurationen von R1 und R2 habe. Dieses Setup soll portabel und mit minimaler Konfiguration auf R3 einsatzbereit sein, wenn A und R3 Internetzugang haben.
Was ich bisher versucht habe:
- Aktivieren der IP-Weiterleitung auf dem Server in /etc/sysctl/conf.
net.ipv4.ip_forward=1
- Hinzufügen von PostUp- und PreDown-Routen auf dem Server wg0.conf gemäßdieser Beitrag
PostUp = ip route add 192.168.102.0/24 via 10.66.66.2 dev wg0
PreDown = ip route del 192.168.102.0/24 via 10.66.66.2 dev wg0
Ich bin ratlos und weiß nicht, wie ich das Problem lösen soll. Für jede Hilfe bin ich sehr dankbar, danke!!
KONFIGURATIONEN:
// /etc/wireguard/params
SERVER_PUB_IP=<PUBLIC_IP_S>
SERVER_PUB_NIC=ens5
SERVER_WG_NIC=wg0
SERVER_WG_IPV4=10.66.66.1
SERVER_WG_IPV6=fd42:42:42::1
SERVER_PORT=53958
SERVER_PRIV_KEY=<PRIVATE_KEY>
SERVER_PUB_KEY=<PUBLIC_KEY>
CLIENT_DNS_1=1.1.1.1
CLIENT_DNS_2=1.0.0.1
ALLOWED_IPS=0.0.0.0/0,::/0
// /etc/wireguard/wg0.conf
[Interface] Address = 10.66.66.1/24,fd42:42:42::1/64
ListenPort = 53958
PrivateKey = <PRIVATE_KEY>
PostUp = iptables -I INPUT -p udp --dport 53958 -j ACCEPT
PostUp = iptables -I FORWARD -i ens5 -o wg0 -j ACCEPT
PostUp = iptables -I FORWARD -i wg0 -j ACCEPT
PostUp = iptables -t nat -A POSTROUTING -o ens5 -j MASQUERADE
PostUp = ip6tables -I FORWARD -i wg0 -j ACCEPT
PostUp = ip6tables -t nat -A POSTROUTING -o ens5 -j MASQUERADE
PostDown = iptables -D INPUT -p udp --dport 53958 -j ACCEPT
PostDown = iptables -D FORWARD -i ens5 -o wg0 -j ACCEPT
PostDown = iptables -D FORWARD -i wg0 -j ACCEPT
PostDown = iptables -t nat -D POSTROUTING -o ens5 -j MASQUERADE
PostDown = ip6tables -D FORWARD -i wg0 -j ACCEPT
PostDown = ip6tables -t nat -D POSTROUTING -o ens5 -j MASQUERADE
### Client R3
[Peer]
PublicKey = <CLIENT_PUB_KEY>
PresharedKey = <CLIENT_PSK>
AllowedIPs = 192.168.103.0/24,fd42:42:42::2/128
### Client A
[Peer]
PublicKey = <CLIENT_PUB_KEY>
PresharedKey = <CLIENT_PSK>
AllowedIPs = 192.168.102.0/24,fd42:42:42::3/128
// A.conf
[Interface]
PrivateKey = <PRIVATE_KEY>
Address = 10.66.66.3/32,fd42:42:42::3/128
DNS = 1.1.1.1,1.0.0.1
[Peer]
PublicKey = <PUBLIC_KEY>
PresharedKey = <PRE_SHARED_KEY>
Endpoint = <PUBLIC_IP>:53958
AllowedIPs = 0.0.0.0/0,::/0
// R3.conf
[Interface]
PrivateKey = <PRIVATE_KEY>
Address = 10.66.66.2/32,fd42:42:42::2/128
DNS = 1.1.1.1,1.0.0.1
[Peer]
PublicKey = <PUBLIC_KEY>
PresharedKey = <PRE_SHARED_KEY>
Endpoint = <PUBLIC_IP>:53958
AllowedIPs = 0.0.0.0/0,::/0