Verzögerung von Netzwerkpaketen durch Wireguard-Tunnel

Verzögerung von Netzwerkpaketen durch Wireguard-Tunnel

Im folgenden Szenario habe ich eine Maschine (a) eingerichtet, die sich hinter einem einfachen NAT ohne weitere Konfiguration befindet und einen Wireguard-Tunnel (wg0) zu einer anderen Maschine (b) herstellt, die mit einer statischen IP und ohne NAT mit dem Internet verbunden ist. (Alle Maschinen laufen unter Debian 10)

Maschine (a) stellt Maschine (b) über Wireguard einen SSH- und einen HTTP-Dienst bereit.

Wenn ich lokal auf Maschine (a) bin, funktioniert alles perfekt, die Maschine reagiert sofort auf alle SSH-Befehle und HTTP-Anfragen.

Der Tunnel (wg0) scheint auch gut zu funktionieren, Handshake funktioniert, Maschine (a) kann Maschine (b) anpingen und umgekehrt kann Maschine (b) per SSH auf den freigegebenen Dienst auf Maschine (b) zugreifen; aber wenn ich beispielsweise VIM über Wireguard (wg0) auf Maschine (a) verwende, dauert es tatsächlich Minuten, um das TUI zu laden, während Nano sofort lädt. Wenn ich Tail-Logs verwende und die Ausgabe umfangreich ist, kann die Anzeige Sekunden bis Minuten dauern. Schließlich dauert es bei HTTP-Anfragen von Maschine (b) über Wireguard (wg0) an Maschine (a) etwa 30 Sekunden, bis die Anfrage erfolgreich ist.

Machine (a)'s wg0 IP: 10.200.1.7 
Machine (a)'s HTTP Port: 9500

Machine (b)'s wg0 IP: 10.200.1.1

Hier ist ein Beispiel für einen TCPdump einer HTTP-Anforderung auf der wg0-Schnittstelle von Maschine (a), der etwa 35 Sekunden benötigte, um erfolgreich zu sein:

01:05:53.261678 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [S], seq 592157087, win 27600, options [mss 1380,sackOK,TS val 4192760482 ecr 0,nop,wscale 7], length 0
01:05:53.261809 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [S.], seq 1181067477, ack 592157088, win 28960, options [mss 1460,sackOK,TS val 1595828258 ecr 4192760482,nop,wscale 7], length 0
01:05:53.284094 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1, win 216, options [nop,nop,TS val 4192760502 ecr 1595828258], length 0
01:05:53.284163 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [P.], seq 1:80, ack 1, win 216, options [nop,nop,TS val 4192760502 ecr 1595828258], length 79
01:05:53.284295 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], ack 80, win 227, options [nop,nop,TS val 1595828280 ecr 4192760502], length 0
01:05:53.312174 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:2737, ack 80, win 227, options [nop,nop,TS val 1595828308 ecr 4192760502], length 2736
01:05:53.312195 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [P.], seq 2737:4240, ack 80, win 227, options [nop,nop,TS val 1595828308 ecr 4192760502], length 1503
01:05:53.312241 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [P.], seq 4240:5310, ack 80, win 227, options [nop,nop,TS val 1595828308 ecr 4192760502], length 1070
01:05:53.312284 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [P.], seq 5310:5315, ack 80, win 227, options [nop,nop,TS val 1595828308 ecr 4192760502], length 5
01:05:53.335447 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1, win 224, options [nop,nop,TS val 4192760554 ecr 1595828280,nop,nop,sack 1 {4105:4240}], length 0
01:05:53.335498 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1, win 241, options [nop,nop,TS val 4192760554 ecr 1595828280,nop,nop,sack 1 {4105:5310}], length 0
01:05:53.335507 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1, win 241, options [nop,nop,TS val 4192760554 ecr 1595828280,nop,nop,sack 1 {4105:5315}], length 0
01:05:53.335548 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595828331 ecr 4192760554], length 1368
01:05:53.567095 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595828563 ecr 4192760554], length 1368
01:05:54.043110 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595829039 ecr 4192760554], length 1368
01:05:54.971106 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595829967 ecr 4192760554], length 1368
01:05:56.794963 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595831791 ecr 4192760554], length 1368
01:05:58.299595 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [F.], seq 5315, ack 80, win 227, options [nop,nop,TS val 1595833295 ecr 4192760554], length 0
01:05:58.320249 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1, win 241, options [nop,nop,TS val 4192765540 ecr 1595828280,nop,nop,sack 1 {4105:5316}], length 0
01:05:58.320392 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595833316 ecr 4192765540], length 1368
01:05:58.547111 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595833543 ecr 4192765540], length 1368
01:05:59.003093 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595833999 ecr 4192765540], length 1368
01:05:59.931111 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595834927 ecr 4192765540], length 1368
01:06:01.755118 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595836751 ecr 4192765540], length 1368
01:06:05.595114 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595840591 ecr 4192765540], length 1368
01:06:13.019153 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595848015 ecr 4192765540], length 1368
01:06:27.611117 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1:1369, ack 80, win 227, options [nop,nop,TS val 1595862607 ecr 4192765540], length 1368
01:06:27.634605 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 1369, win 263, options [nop,nop,TS val 4192794853 ecr 1595862607,nop,nop,sack 1 {4105:5316}], length 0
01:06:27.634721 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 1369:2737, ack 80, win 227, options [nop,nop,TS val 1595862630 ecr 4192794853], length 1368
01:06:27.634755 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], seq 2737:4105, ack 80, win 227, options [nop,nop,TS val 1595862630 ecr 4192794853], length 1368
01:06:27.656603 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 2737, win 284, options [nop,nop,TS val 4192794876 ecr 1595862630,nop,nop,sack 1 {4105:5316}], length 0
01:06:27.656683 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [.], ack 5316, win 305, options [nop,nop,TS val 4192794877 ecr 1595862630], length 0
01:06:27.658916 IP 10.200.1.1.58062 > 10.200.1.7.9500: Flags [F.], seq 80, ack 5316, win 305, options [nop,nop,TS val 4192794877 ecr 1595862630], length 0
01:06:27.659043 IP 10.200.1.7.9500 > 10.200.1.1.58062: Flags [.], ack 81, win 227, options [nop,nop,TS val 1595862655 ecr 4192794877], length 0

Ich habe auch von einer Maschine (c) über einen anderen Tunnel (wg1) getestet, mit demselben Verhalten auf Maschine (a) …

Haben Sie eine Idee, was diese Probleme verursachen könnte? Vielen Dank für jeden Rat!

Antwort1

Wenn ich die MTU (Paketlänge) reduziere, funktioniert alles einwandfrei

ip link set dev wg0 mtu 1200

verwandte Informationen