[SOLVED]slow download speed and 100% CPU load with wireguard

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 8:31    Post subject: [SOLVED]slow download speed and 100% CPU load with wireguard Reply with quote
Hi,

I have some troubles with my wireguard clients while using the routers wifi since I switched from cable (auto DHCP) to VDSL (PPPoE). Normally I could use both at the same time without noticing any performance issues. Now my download rate drops to 0.3 Mbps with wireguard+wifi (even to the local network like NAS) and the router shows 100% CPU load.

My Setup:
ASUS RT-AC68U (DD-WRT v3.0-r46974 std (06/18/21))
oet1: commercial VPN (DDNS: vpn.mydomain.com) for the IP ranges 10.0.0.0/24 (local lan/wifi) and 10.0.1.0/24 (wireguard/oet2)
oet2: wireguard server (DDNS: isp.mydomain.com) (IP: 10.0.1.0/24)

oet1 setup:


oet2 setup:


wan setup (I tried to set the MTU to auto, but it reverts back to "manual: 1492")


Android Phone:
wifi: ~250 Mbps down/up (low router CPU load)
wireguard+LTE: ~20 Mbps down / 15 Mbps up (low router CPU load)
wireguard+wifi: 0.3 Mbps down / 20 Mbps up (100% router CPU load)



With the old cable modem I used an MTU of 1420 for oet1 and 1280 for oet2. This was also the first setup with VDSL with the same results as above. Now I'm using a MTU of 1432 (and tried many other from 1000-1500), allways with the same result.

Is this a routing problem? are my PBR settings wrong?

Code:

# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         xxx.xxx.xxx.xxx 0.0.0.0         UG    0      0        0 ppp0
10.0.0.0        0.0.0.0         255.255.0.0     U     0      0        0 br0
10.0.1.0        0.0.0.0         255.255.255.0   U     0      0        0 oet2
10.0.1.1        0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.0.1.10       0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.0.1.20       0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.0.1.30       0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.0.1.40       0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.0.1.50       0.0.0.0         255.255.255.255 UH    0      0        0 oet2
10.34.0.0       0.0.0.0         255.255.0.0     U     0      0        0 oet1
xxx.xxx.xxx.xxx 0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx 255.255.255.255 UGH   0      0        0 ppp0


Last edited by frashman on Thu Jul 15, 2021 9:27; edited 1 time in total
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12913
Location: Netherlands

PostPosted: Thu Jul 15, 2021 8:47    Post subject: Reply with quote
To exclude any interference just disable oet2 (the "server") no worries your settings are retained.

For PPPoE you have to lower the MTU with 8 from your previous values so use 1412

Reboot your router and run speed tests again.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 16:00    Post subject: Reply with quote
I've already tried that and there is no difference in the result.

But I had another idea that took me a little further.

I have assigned the DDNS domain to my local DNS (Dnsmasq option: address=/isp.mydomain.com/10.0.0.1) so that the Android client uses 10.0.0.1 as endpoint over WiFi and my WAN address over LTE. And now I have almost full speed without 100% CPU load.

But this solution is a bit dirty because now isp.mydomain.com is assigned to my WAN address and router IP. And apparently the Wireguard client is a bit overwhelmed with that on network change. So it is a kind of "routing problem".

Do you have any idea what I can do about it?

Edit: However, this still does not solve a fundamental problem, because if I switch from the LTE network to Wifi without restarting wireguard (so the WAN IP is still the DNS) I have low speed and 100% CPU load again


Last edited by frashman on Thu Jul 15, 2021 16:10; edited 1 time in total
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12913
Location: Netherlands

PostPosted: Thu Jul 15, 2021 16:08    Post subject: Reply with quote
Are you saying you disable oet2 and when connecting a client to your router (preferably wired) which uses your commercial provider you have a very bad download speed?

If so I do not see an apparent routing problem.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 16:17    Post subject: Reply with quote
no. the download speed is slow with wifi+wireguard (VPN always on). with LTE+wireguard everything is fine.

all other clients (lan/wifi) within the commercial vpn route (10.0.0.0, 10.0.1.0) and other ranges without the commercial vpn (10.0.2.0, 10.0.3.0 and so on) are fine too.

its just the combination of wireguard+wifi which slows down the connection
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 16:36    Post subject: Reply with quote
i should mention the slow connection just affect the one specific client.

so while one client connects via wifi and wireguard (most likely my phone, because of the "VPN allways on" option) its connection slows rapidly down while other clients are working fine with full speed (local and internet)

the speedtest I'm using is selfhostet on a local machine (https://github.com/librespeed/speedtest)
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12913
Location: Netherlands

PostPosted: Thu Jul 15, 2021 16:41    Post subject: Reply with quote
But your router is doing the wireguard , your Phone connected via WiFi to your router should not have wireguard client running.

Edit:
For WireGuard just like open VPN (tun) the server, the VPN subnet, and the client have to be on different subnets, if you try to connect with your phone running a WG client to your server on the same network you will either have no connection or cause looping.


Edit 2:
If you run a WireGuard client to the same provider on your phone and on your router you are running a tunnel in a tunnel, probably that will result in problems at your providers end but at least you have to lower the MTU of your phone 40 or 60 below the MTU of your router

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 17:03    Post subject: Reply with quote
okay, let me put this from another direction, and keep in mind the setup was working before.

My phone is tied to my home network because there are many services, like contact and calender sync, fileserver and so on, running on a local machine (kind of a litte homeserver) since I deeply distrust any services provided by companies like google. So, my phone using the "allways on vpn" option to have a steady connection to my network, regardles of wifi or mobile network.

I moved 4 weeks ago, and must use another internet provider since my cable company don't have service here. So I got VDSL.

And since then, the connection from my phone slows down to 0.3 Mbps when i'm at home and goes back to LTE speed when I'm not at home. Maybe I had this issue before, but it wasn't noticable.

All I can think of is a possible wrong route or something, since I testet many different MTUs.
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Thu Jul 15, 2021 17:34    Post subject: Reply with quote
egc wrote:

Edit:
For WireGuard just like open VPN (tun) the server, the VPN subnet, and the client have to be on different subnets, if you try to connect with your phone running a WG client to your server on the same network you will either have no connection or cause looping.


They are on different subnets. The wifi IP is 10.0.0.10 (24) and the wireguard IP is 10.0.1.10 (24). The client also uses "allowed ip 0.0.0.0/0" so all traffic goes through the VPN

oet1 (commercial vpn) routes all traffic comming from 10.0.0.0/24 (wifi/eth) and 10.0.1.0/24 (wg). but this should not address the problem, so forget it. I can disable oet1 and the result is the same...

egc wrote:

Edit 2:
If you run a WireGuard client to the same provider on your phone and on your router you are running a tunnel in a tunnel, probably that will result in problems at your providers end but at least you have to lower the MTU of your phone 40 or 60 below the MTU of your router


this is not the case. the wg client route on the phone is "Phone > WIFI/LTE > Router WG Server > Router WG commercial VPN > Internet"
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12913
Location: Netherlands

PostPosted: Fri Jul 16, 2021 16:15    Post subject: Reply with quote
I finally found some time to duplicate your setup (sort of) and had no problem getting it to work.
So the good news is that it could/should work the bad news is I have no idea why it does not work for you Sad

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Sat Jul 17, 2021 14:04    Post subject: Reply with quote
okay thanks for your help. I'll do a factory reset and build everything from scratch
frashman
DD-WRT Novice


Joined: 19 Aug 2020
Posts: 17

PostPosted: Tue Jul 20, 2021 8:21    Post subject: Reply with quote
I built everything from scratch and its working again.

That is the big disadvantage of dd-wrt because I have the feeling that everything changes with every revision and is no longer compatible with each other or you adjust a setting on one side and tear it all down on another. I've done this the second time now, although I always work cleanly and don't make any adjustments that I don't need.

anyway, thanks for your help!
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12913
Location: Netherlands

PostPosted: Tue Jul 20, 2021 8:43    Post subject: Reply with quote
Glad it is working.

To be honest you had been tinkering a lot with different settings and then indeed the best solution is to reset to defaults and start fresh (never restore from backup Smile )

But DDWRT is on the bleeding edge and that comes with a price, for the routers I test/tinker with I have screenshots and an occasional reset and putting in settings manually is sometimes the best solution to get a stable working build.

But the family router (R7800) has not been resetted in almost two years and is now running 47073 Smile
But it is pretty standard only WG server running besides normal internet and port forwarding duties.

But anyway thanks for reporting back at least we know it is not a structural problem.

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum