wireguard issue?

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
johnnyNobody999
DD-WRT Guru


Joined: 10 Jan 2014
Posts: 504

PostPosted: Fri Jul 09, 2021 0:43    Post subject: wireguard issue? Reply with quote
I've been having problems with slow web page performance for some time. I don't know when it started but nothing in my configuration has changed. Most of my troubles are with youtube buffering but I've had problems with a couple other sites - mostly forums. I was hoping that it was a firmware issue but I've done 3 firmware upgrades in the past month and still have the problem. Internet speed tests look good though. DNS looks like it's working OK. Reboot of the R9000 for the WAN connection doesn't help. It doesn't matter if it's a wired or wireless connection. Currently running firmware 47033 on my Netgear routers (WDS arrangement). Performance looks much better with wireguard turned off on the clients.
Sponsor
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Fri Jul 09, 2021 14:15    Post subject: Reply with quote
Maybe the following applies (from the troubleshooting section of the wg guide):
Quote:
MTU size problems (Connection, but no traffic, hang, slow loading, or no streaming media)

MTU problems often manifest themselves as connections which hang during
periods of active usage, or does not load the whole page when browsing.
Or you can connect but not see or use streaming media (like an IP camera, Facebook etc.) or your connection is unexpected slow.

The MTU (Maximum Transmission Units) is the maximum datagram size in bytes that can be sent unfragmented over a particular network path.
Wireguard requires that packets be sent unfragmented.

MTU size is set in the GUI and is standard 1440 for IPv4 and 1420 for IPv6. But sometimes this is too high
especially if you are using connection via LTE.
You can try lowering the MTU wit trial and error i.e. start at 1024 (for IPv6 the minimum MTU is 1280) and work your way up or use the approach describe at: https://www.sonassi.com/help/troubleshooting/setting-correct-mtu-for-openvpn

Make sure to reboot the router after changing!

Checking the right MTU size:
https://hamy.io/post/0003/optimizing-openvpn-throughput/
https://blog.hambier.lu/post/solving-openvpn-mtu-issues

_________________
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
tedm
DD-WRT Guru


Joined: 13 Mar 2009
Posts: 555

PostPosted: Fri Jul 09, 2021 18:21    Post subject: Reply with quote
I was thinking exactly the same thing - I had almost an identical problem with 2 sites of a customer of mine last month - both supplied by the same ISP. Setting MTU to 1400 magically fixed everything. I then went back and started polishing my flamethrowers since when I meet with a tech next week from that ISP I'm gonna light him up like the 4th of July.

My suggestion though is that before messing with any settings on the router you TEST with setting the MTU on the clients.

If you have a Windows 10 client you can do this at an elevated command prompt with the command

Netsh interface ipv4 set subinterface 'Ethernet" mtu=1400 store=persistent

of course your interface may not be named "Ethernet" so you need to list them first to find the name in use. Look up netsh syntax for this.

Other clients (mac/linux/etc) are going to have different ways of doing this.

One big advantage of doing it this way is even if you get the settings on the router adjusted right, your router will still be fragmenting packets which involves extra work for all the devices. However if your sending host already knows the MTU is lower than 1500 it won't send out a packet that needs to be fragmented in the first place. And it will also assist with MTU path discovery assuming that this protocol isn't blocked since the receiver on the other end of the connection will also know not to send you large packets.
johnnyNobody999
DD-WRT Guru


Joined: 10 Jan 2014
Posts: 504

PostPosted: Fri Jul 09, 2021 18:46    Post subject: Reply with quote
Thanks for the info but I'm wondering if I'm doing something wrong. Here's how I'm doing this:

1. Run ping test with successively smaller packet sizes until I get no error message.
2. Put that packet size into both the wireguard "server" and client.
3. Reboot router and restart wireguard on client.
4. Test again
5. Failure?
a. Yes - repeat test until MTU no longer generates error
1) Goto step 2 above
b. No - end


When I do the ping test with the new MTU size the test fails. So I repeat the test with a reduced MTU until it no longer generates the error (ping: local error: message too long, mtu=####). Then I put the new MTU value in the client and server, reboot/restart, and retest - I get the error message with the new value again.
SurprisedItWorks
DD-WRT Guru


Joined: 04 Aug 2018
Posts: 1447
Location: Appalachian mountains, USA

PostPosted: Fri Jul 09, 2021 20:38    Post subject: Reply with quote
FWIW, an edit of @egc's wireguard guide for clients connecting to commercial providers acquired a small edit not long ago. It pointed out that even IPv4-only router setups may need MTU 1420 rather than the usual 1440 if the wireguard provider also supports IPv6 clients. That turned out to solve all of my wireguard issues. With 1440 I routinely had failed curls in scripts and other mysterious brief failures. At 1420 it's all golden.
_________________
2x Netgear XR500 and 3x Linksys WRT1900ACSv2 on 53544: VLANs, VAPs, NAS, station mode, OpenVPN client (AirVPN), wireguard server (AirVPN port forward) and clients (AzireVPN, AirVPN, private), 3 DNSCrypt providers via VPN.
johnnyNobody999
DD-WRT Guru


Joined: 10 Jan 2014
Posts: 504

PostPosted: Sat Jul 10, 2021 0:13    Post subject: Reply with quote
I solved my MTU issues and it seems that streaming is looking better so far. I ended up setting the MTU to 1390 on the wireguard server and deleted the MTU setting in the clients or set them to auto (which is what happened on the smartphone). I'm using only IPv4.
johnnyNobody999
DD-WRT Guru


Joined: 10 Jan 2014
Posts: 504

PostPosted: Sat Jul 10, 2021 18:08    Post subject: Reply with quote
johnnyNobody999 wrote:
I solved my MTU issues and it seems that streaming is looking better so far. I ended up setting the MTU to 1390 on the wireguard server and deleted the MTU setting in the clients or set them to auto (which is what happened on the smartphone). I'm using only IPv4.


Turns out the MTU setting didn't fix the problem. So, the search for a solution continues......
johnnyNobody999
DD-WRT Guru


Joined: 10 Jan 2014
Posts: 504

PostPosted: Sun Jul 11, 2021 2:28    Post subject: Reply with quote
I don't know if the second rule is the problem but it is different than what is shown in the wireguard guide troubleshooting section:

root@r9000master:~# iptables -vnL INPUT
Chain INPUT (policy ACCEPT 0 packets, 0 bytes)
pkts bytes target prot opt in out source destination

1 84 ACCEPT all -- oet1 * 0.0.0.0/0 0.0.0.0/0 state NEW
0 0 ACCEPT udp -- vlan2 * 0.0.0.0/0 0.0.0.0/0 udp dpt:51820
968 233K ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
0 0 DROP icmp -- vlan2 * 0.0.0.0/0 0.0.0.0/0
0 0 DROP 2 -- vlan2 * 0.0.0.0/0 0.0.0.0/0
191 12639 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 state NEW
501 119K ACCEPT all -- br0 * 0.0.0.0/0 0.0.0.0/0 state NEW
99 11103 DROP all -- * * 0.0.0.0/0 0.0.0.0/0
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