We bought a new WiFi router / ADSL modem at home (Asus DSL-N55U-B) and the wifi connection occasionally has very high latencies (up to 20 seconds, versus most common 25 miliseconds when pinging google (simple ping google.com on linux) ).
This shows up on many different devices (Windows, Linux, Android, iOS), so it's probably not a problem on the end device.

First thing I did was to check cpu load on the router, but it stays around 3% all the time.
I checked used wifi channels, and tried to move our channel further from others used in our neighborhood, but this didn't help.
Last thing I tried was looking at our channel with kismet and noticed that there is fairly large retry rate about half of packet rate. I'm not sure what this means exactly, but it seems suspicious to me.

The router is running linux and I have root access, so I'm not too limited in diagnostics I can run on it.

Do you have any pointers where should I continue to fix this?

Edit

So I got a new router (D-Link this time) and it's working just fine. The problem I faced with the previous router remains a mystery :-) Thanks to all for the answers.

What are you testing latency to? do you have ping to the router and to a public site? 20 seconds is quite high 5 seconds (5000 ms) is the default timeout for ICMP requests, this makes wonder what you are using to measure latency.
–
KyleDec 28 '12 at 17:09

I'm only doing ping google.com. When watching the packets in wireshark I'm seeing echo requests at regular intervals, but the replies look like they are held somewhere for those few seconds and then released all at once when the problem appears.
–
cubeDec 28 '12 at 22:48

If you are using windows try a tracert to google.com just to be sure it is the router and not another device a few hops down. Also when you ping google ping your router as well in a seperate window to compare the latency.
–
KyleDec 28 '12 at 23:03

3 Answers
3

Try installing DD-WRT. See if this alleviates the problem. Poor software of dubious outsourced origin could be causing the bottleneck.

Try starting Windows in safe mode, with networking obviously. If this is good, then run it normally but try to kill any packet heavy processes such as torrents. I notice some routers can't handle torrents well at all, not due to actual bandwidth but processing the number of packets needed.

If you have [DD-WRT] installed, try uninstall it and going back to factory default firmware. I've seen DD-WRT have it's own random bugs.

For hardware:

Try replacing the router with the same model.

Try using the same router with another computer on a different network.

For Network issues:

Try the windows network diagnostic tool

Use a traceroute application to confirm where the issue is occuring, and if the nature of the issue is packet loss and/or high latency.

For Radio Frequency issues:

Try changing your wifi channnel. There may be too much interference in your local area. You don't want to be on a crowded channel, but that is more of a bandwidth optimization than a fix for latency (usually).

You can use a windows program called "inssider". There are different versions of it out there, some freeware/trialware that will do the job.

Thanks for the answer. Trying another router of the same model or using different firmware would probably tell me a lot about the router, but I only have one and don't where I could borrow another one and for the DD-WRT -- I don't fell comfortable doing this kind of operations on it, I have a feeling it would never boot up again :)
–
cubeDec 28 '12 at 16:51

Not exactly what you describe but maybe a path to investigate: if this "latency" happens early after connection to the network and then disappears you may want to check your DNS settings.

There are several cases where you connect to a service and the first part goes quickly, then everything hangs for some time. This is often the case when you connect via SSH to a server and you wait until the actual prompt appears (with the connection itself being live.

You may want to try to bypass DNS setting by directly naming your target device in /etc/hosts (Linux) or C:\Windows\System32\drivers\etc\hosts (MS Windows -- I always found that this is a weird place to store this file). An example of the host can be found on Wikipedia.

You can also try to switch on/off the varion LMHOSTS and WINS settings on MS Windows (found in the The Proprieties of the WiFi card -> TCP/IP)

I'd try bypassing your wireless entirely, and plug your computer into one of the wired ports on the back of your router. Do that, and see if your ping improves. If it does, then you know something is funky with your WiFi setup, if it doesn't then I'd start looking into your DNS provider.

Try switching to the Google DNS within your router and see if that changes anything(8.8.8.8). Run a continuous ping for a few mintues to verify that your average connection speed beats the old DNS. If it does, your ISP has slow/overloaded servers and stick with Google DNS. If it doesn't your connection itself may be poor, or the router's wired interface is also slow. If this is the case, bypass your router entirely and plug your computer into your modem directly.

Repeat the same steps as above and see if it alleviates the issue. If the connection is indeed faster when bypassing the router, then get a new router, end of story. If it isn't, your having connection issues either from your house to the pole, or beyond on the ISP end.

I'd would avoid reflashing your router if your not comfortable with it, and it doesn't guarantee you better performace. Messing with the hosts file is also not a sure way to fix anything. Your best bet is to make sure your equipment is all working properly before you dig any deeper into the issue.

I'm pretty certain it's not a DNS problem. I've tried using wired connection as a first thing and there's no problem with it this way. The hight latencies only apear on wifi.
–
cubeDec 28 '12 at 22:59

How strong is your wifi signal (db)? I'd be inclined to think your router is fine since it a a decent piece of equipment. Have you tried to standing next to the wifi router and seeing if latency improves?
–
Lee HarrisonJan 2 '13 at 16:21