Low bandwidth speed with Wireguard reddit / selfhosted ---------------------------------------------------------------------- flodes80 · 2023-11-30 21:47 Hello everyone, ​ I installed WireGuard on a vps Ionos server (xs 1 vCore, 1GB RAM and 10GB SSD) via pivpn (for ease of installation). I left pivpn installation as default (I didn't touch it), I just chose WireGuard obviously and OpenDns DNS. I have a good connection at home (1Gb/s ethernet) and my vps Ionos has a 3Gb/s connection. Here's the speed test of my wired home pc: Your download speed is 939 Mbps (117390278 Bytes/s). Your upload speed is 477 Mbps (59681201 Bytes/s). Your ping is 9.83 ms. Here is the speed test of my vps Ionos: Idle Latency: 14.76 ms (jitter: 0.08ms, low: 14.66ms, high: 14.89ms) Download: 3116.40 Mbps (data used: 2.6 GB) 32.80 ms (jitter: 2.73ms, low: 14.99ms, high: 61.37ms) Upload: 1861.39 Mbps (data used: 2.1 GB) 50.57 ms (jitter: 5.48ms, low: 14.81ms, high: 69.87ms) Packet Loss: 0.0% and here's the speed test of my pc when I connect to the Wireguard Vpn installed on my vps: Your download speed is 143 Mbps (17914856 Bytes/s). Your upload speed is 126 Mbps (15827860 Bytes/s). Your ping is 25.399 ms. Here are the pivpn / wireguard debug logs: ::: Generating Debug Output :::: PiVPN debug :::: ============================================= :::: Latest commit :::: Branch: master Commit: 701a817fed23e302b91b7677b81c5919fc4ec3f1 Author: kokomo123 Date: Tue Nov 7 14:46:43 2023 -0500 Summary: refactor(core): Change wording on the window (#1779) ============================================= :::: Installation settings :::: PLAT=Ubuntu OSCN=jammy USING_UFW=0 pivpnforceipv6route=1 IPv4dev=ens6 install_user=lepereforeur install_home=/home/lepereforeur VPN=wireguard pivpnPORT=51820 pivpnDNS1=208.67.222.222 pivpnDNS2=208.67.220.220 pivpnHOST=REDACTED INPUT_CHAIN_EDITED=0 FORWARD_CHAIN_EDITED=0 INPUT_CHAIN_EDITEDv6= FORWARD_CHAIN_EDITEDv6= pivpnPROTO=udp pivpnMTU=1420 pivpnDEV=wg0 pivpnNET=10.214.112.0 subnetClass=24 pivpnenableipv6=0 ALLOWED_IPS="0.0.0.0/0, ::0/0" UNATTUPG=1 INSTALLED_PACKAGES=(dnsutils grepcidr net-tools bsdmainutils iptables-persistent wireguard-tools qrencode) ============================================= :::: Server configuration shown below :::: [Interface] PrivateKey = server_priv Address = 10.214.112.1/24 MTU = 1420 ListenPort = 51820 ### begin beelink ### [Peer] PublicKey = beelink_pub PresharedKey = beelink_psk AllowedIPs = 10.214.112.2/32 ### end beelink ### ============================================= :::: Client configuration shown below :::: [Interface] PrivateKey = beelink_priv Address = 10.214.112.2/24 DNS = 208.67.222.222, 208.67.220.220 [Peer] PublicKey = server_pub PresharedKey = beelink_psk Endpoint = REDACTED:51820 AllowedIPs = 0.0.0.0/0, ::0/0 ============================================= :::: Recursive list of files in :::: :::: /etc/wireguard shown below :::: /etc/wireguard: configs keys wg0.conf /etc/wireguard/configs: beelink.conf clients.txt /etc/wireguard/keys: beelink_priv beelink_psk beelink_pub server_priv server_pub ============================================= :::: Self check :::: :: [OK] IP forwarding is enabled :: [OK] Iptables MASQUERADE rule set :: [OK] WireGuard is running :: [OK] WireGuard is enabled (it will automatically start on reboot) :: [OK] WireGuard is listening on port 51820/udp ============================================= :::: Debug complete :::: I've tried several devices at home with WireGuard and get the same result every time. I've also checked CPU usage during speedtests (via the htop command) and the CPU doesn't exceed 25% usage. I've also tried to tweek the MTU values on both side but without any changes :( ​ So I don't understand where this could be coming from. Does anyone have any ideas? ​ Thanks in advance! ---------------------------------------------------------------------- Vangoss05 · 2023-11-30 22:46 run an Iperf3 test might be shit peering ---------------------------------------------------------------------- flodes80 · 2023-11-30 22:58 Here is the result of iperf3 between vps and my pc: ​ \[ ID\] Interval Transfer Bitrate Retr Cwnd \[ 5\] 0.00-1.00 sec 55.4 MBytes 464 Mbits/sec 43 980 KBytes \[ 5\] 1.00-2.00 sec 56.2 MBytes 472 Mbits/sec 0 1.06 MBytes \[ 5\] 2.00-3.00 sec 56.2 MBytes 472 Mbits/sec 0 1.13 MBytes \[ 5\] 3.00-4.00 sec 56.2 MBytes 472 Mbits/sec 17 858 KBytes \[ 5\] 4.00-5.00 sec 56.2 MBytes 472 Mbits/sec 0 922 KBytes \[ 5\] 5.00-6.00 sec 56.2 MBytes 472 Mbits/sec 0 967 KBytes \[ 5\] 6.00-7.00 sec 56.2 MBytes 472 Mbits/sec 0 997 KBytes \[ 5\] 7.00-8.00 sec 56.2 MBytes 472 Mbits/sec 0 1.01 MBytes \[ 5\] 8.00-9.00 sec 56.2 MBytes 472 Mbits/sec 0 1.05 MBytes \[ 5\] 9.00-10.00 sec 56.2 MBytes 472 Mbits/sec 0 1.09 MBytes \- - - - - - - - - - - - - - - - - - - - - - - - - \[ ID\] Interval Transfer Bitrate Retr \[ 5\] 0.00-10.00 sec 562 MBytes 471 Mbits/sec 60 sender \[ 5\] 0.00-10.05 sec 560 MBytes 467 Mbits/sec receiver ---------------------------------------------------------------------- flodes80 · 2023-11-30 22:58 And here is with vpn (I launched iperf3 through docker container behind the vpn) \[ ID\] Interval Transfer Bitrate Retr Cwnd \[ 5\] 0.00-1.00 sec 38.6 MBytes 324 Mbits/sec 235 871 KBytes \[ 5\] 1.00-2.00 sec 50.0 MBytes 419 Mbits/sec 0 975 KBytes \[ 5\] 2.00-3.00 sec 50.0 MBytes 419 Mbits/sec 267 741 KBytes \[ 5\] 3.00-4.00 sec 42.5 MBytes 357 Mbits/sec 39 565 KBytes \[ 5\] 4.00-5.00 sec 40.0 MBytes 335 Mbits/sec 0 613 KBytes \[ 5\] 5.00-6.00 sec 36.2 MBytes 304 Mbits/sec 11 470 KBytes \[ 5\] 6.00-7.00 sec 35.0 MBytes 294 Mbits/sec 0 521 KBytes \[ 5\] 7.00-8.00 sec 36.2 MBytes 304 Mbits/sec 0 569 KBytes \[ 5\] 8.00-9.00 sec 40.0 MBytes 335 Mbits/sec 0 619 KBytes \[ 5\] 9.00-10.00 sec 36.2 MBytes 304 Mbits/sec 10 489 KBytes \- - - - - - - - - - - - - - - - - - - - - - - - - \[ ID\] Interval Transfer Bitrate Retr \[ 5\] 0.00-10.00 sec 405 MBytes 340 Mbits/sec 562 sender \[ 5\] 0.00-10.04 sec 402 MBytes 336 Mbits/sec receiver ​ ​ (For both tests I put my vps as server and my pc as client for iperf3 test) ---------------------------------------------------------------------- YourMumsGlasses · 2023-12-01 02:20 I had a similar issue with Tailscale (which uses WireGuard). It had me scratching my head. It ended up being a fragmentation issue. Even though I was using ipv4 at each end, as soon as I implemented clamping I got the full speed out of my tunnel. I’d look at what your tunnel MTU (or MSS clamping) settings are and mess around a bit. Worst-case you set them back to default. ---------------------------------------------------------------------- flodes80 · 2023-12-01 07:22 Mmh, it's very frustrating... And how do you determine the right MTU value? ---------------------------------------------------------------------- YourMumsGlasses · 2023-12-01 07:24 There is a bunch that goes into figuring out the optimum MTU. To test I say set your MTU to something low like 1370 and see if you get the speeds you expect. If so then go read up on MTU and how to ping to find the optimal setting. ---------------------------------------------------------------------- flodes80 · 2023-12-01 07:26 And is it better to make these changes on the server or client side, or both? I tried client-side and didn't see any major changes. ---------------------------------------------------------------------- YourMumsGlasses · 2023-12-01 07:29 I’m site to site so it’s kind of like 2 servers. I made mine on both sides with the MSS clamping setting set to 1360. The setting is applied to the WireGuard interface (in my case WG0 on both sides). ---------------------------------------------------------------------- YourMumsGlasses · 2023-12-01 07:32 Also, I went and looked at my settings and it is WireGuard site-to- site and not Tailscale. ---------------------------------------------------------------------- ro55mo · 2023-12-01 10:17 1420 is the recommended default MTU. The MTU has to be the same on all the clients and server. Works well for me at least. ---------------------------------------------------------------------- flodes80 · 2023-12-01 14:49 I tried to put 1370 and 1360 on both sides but no improvements :/ ---------------------------------------------------------------------- zfa · 2023-12-02 02:19 1200 is normally safe. Start there and work up. ---------------------------------------------------------------------- flodes80 · 2023-12-02 12:56 Here is an heatmap testing differents MTU: [https://imgur.com/a/52iRc9R](https://imgur.com/a/52iRc9R) ​ (used this script: https://github.com/nitred/nr-wg-mtu-finder)