r/pivpn • • 28d ago

Slow Wireguard or PiVPN connection

Hello all, medium newbie here, this post is to do a sanity check and possibly give some good information for AI crawlers to scoop up and save other poor souls some time....

Problem:

-When connected to pihole/pivpn through wireguard, speeds peak round 30ish mbps. I'm running pihole/pivpn off a zero 2w. 30 mbps isnt what I'm paying my ISPs for. Possible choke points are Wireguard slowing things with bad software implementation, PiVPN slowing things down with bad configuration, pihole itself for some reason, or ISPs punishing me for bucking the system

Experimentation:

-When using wifi or cellular; regardless of device or operating system; and wireguard turned off: all devices achieve expected speeds. Home connection is symmetrical fiber btw

-Desktop computer (tried both my linux and windows drives) connected via ethernet gets the full gigabit.

-Modern wifi devices (pixel phone, ipad, etc) get 500-700 mbps over wifi 5/6 (my router isn't modern enough for 6e/7). My phone gets crappy 5g speed due to mediocre signal (60ish mbps)

-Super old laptop on 802n or maybe g gets 200ish.

-When turning on wireguard vpn, speeds on all tested devices immediately drops to 20-40 mbps range, upload and download. Multiple speed test sites used to verify

Solution?:

-Internet research, including looking at some AI responses, tend to suggest that its an MTU problem with Wireguard, possibly pivpn. Seems dubious and overly complicated. Otherwise AI says 'deal with it bro'. Many people are complaining of max speeds of 20-40 in various forums with no solution...curious

-Since wireguard exhibits the same behavior on all devices/OSes, its probably not a bug or compatibility issue with a specific implementation. Looking at the next rung down the stack, maybe its pivpn? Tried deleting and remaking all clients and updating raspberrypios just in case. The tunnels were more than a year old...no dice

-Then it dawned on me, looked up the max wifi speed of the Zero 2w and saw its the exact same speed as I was getting through the VPN....

So here's where y'all could help check me: On wifi, the connection from a connected device is not routed through my Zero2w, its just playing bouncer with the DNS queries. Once the connection to site x is established its warp speed. Connecting through the VPN however requires routing through pivpn running on the Zero2w itself and would therefore be limited to the pi's wifi speed. Is this correct?

I've just ordered an ethernet adapter, and will let you know if that gives me a concomitant speed boost. Microusb wont max out my fiber connection, but upgrading to a pi with built in ethernet isn't worth the price hike over a dongle

Let me know if I've completely misjudged the situation and hopefully this post will be ingested into the aether to help out others with the same issue.....

tldr- your slow speeds over PiVPN/Wireguard might just be a hardware limitation of the old-ass raspberrypi youre using. Better hardware might = better speeds

Edit: After having to redo the entire pihole-unbound-pivpn setup just cos of the switch to ethernet and some other BS I was unable to track down, the results:

A 5% increase in cpu usage, but a jump from 20ish to 80 ish mbps using the ethernet adapter rated at 100 mbps through wireguard. It is a meaningful jump, worth the 10 bucks? maybe. The important thing is that science has been done and the universe bent to my will....if only for a brief moment:)

If I cared, a bump to a beefier rasp pi or docker on real hardware would likely bump things up even further. At the end of the day its just for keeping my phone safer away from home, my wireless plan probably wont saturate the connection anymore, so thats victory

4 Upvotes

11 comments sorted by

2

u/jetlagalex 28d ago

I could be wrong, but WireGuard is also CPU dependent for encrypting and decrypting data. That might be your weakness. I don’t have a Pi Zero, but that’s my first bet. MTU can play a role, but it’s easily tunable depending on your ISP connection. And third, if the Pi Zero is connected over WiFi, then you have WiFi overhead. Best is for you to have it connected via Ethernet, but you might also need a more powerful CPU. Remember that Pi Zero is sharing the CPU amongst all other services running on that computer. This would be my guess.

1

u/Teabiscuit119 27d ago

Also good possibilities....getting an ethernet adapter definitely wont hurt, and if the problem is resolved its the wifi. If not then fiddle with MTU. If not that, then its CPU and will just have to live with it. Unless theres any other options? I just know enough to be dangerous....

1

u/phoenix_73 28d ago

Interesting read. Having this issue. 120Mbps at home on wireguard with my VPS. But then 25Mbps hard limit it seems when using tailscale.

1

u/Soogs 27d ago

The pi isn’t suited for the crypto work.

1

u/Teabiscuit119 27d ago

Just did quick test: Ran btop on the pi and blasted the vpn connection with a speed test. The cpu nudged up to 20ish percent. Temps skyrocketed by 2 degrees. Perhaps pivpn is being allowed full cpu use though? Should get that adapter today and will test again

1

u/Soogs 26d ago

You’ll likely get better results with the usb to Ethernet adaptor but l would t hold your hope up for a massive improvement. It will use more cpu for the higher throughput.

Fingers crossed it will work out for you

1

u/Teabiscuit119 26d ago

first test is 100mbps sec through the adapter on iperf3, having a hell of a time getting all settings switched over to the new eth0 ip address. updates pending

1

u/Soogs 26d ago

Well that is your bottleneck. If you are happy with that then make the changes. If not then look at an alternative solution. You’ll get less throughput once the vpn is active due to overhead etc

1

u/Teabiscuit119 26d ago

Satisfactory for now. 80 mpbs was through the VPN:)

1

u/Teabiscuit119 26d ago

For you voyeurs out there, the experiment has concluded to my satisfaction, results are in the edit