Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have recently purchased a machine to run an online game server. I put the machine together and have installed a fresh copy of Ubuntu Server 10.10. I have noticed that the game server produces a massive amount of lag despite being more than capable of running the server application.

I have been trying to track down the problem all day and now believe it might be something to do with the network connection as when I connect to the server using SSH, on the local network, I get a large dollop of lag before the password field appears. Connecting to the old server on the same network displays the prompt instantly.

My hardware is as follows:

Core i5 2500 3.3GHz Socket 1155
Asus P8P67 R3 Socket 1155
4GB DDR3 1333MHz
500GB 3.5" SAT-III Hard Drive

I use Windows primarily and would ordinarily look for updated drivers if this happened there but I don't really know where to start to solve this problem on Linux.

Any help would be most appreciated.

share|improve this question
There are many potential sources of lag, drivers aren't the most likely culprits. Run ssh -vvv and try to figure out which steps are taking abnormally long. Check for messages in the server logs (/var/logs/syslog, /var/log/auth.log). Run tcpdump -n as root to see when there's a delay between packets. – Gilles Apr 1 '11 at 21:18
Well the network latency seems to have decided to repair itself for now. I ran ssh -vvv and it stopped after: debug2: key: /root/.ssh/id_dsa ((nil)) – Nat Ryall Apr 1 '11 at 22:01
Stopped, or paused? A small delay at that stage (I think it's at that stage) is expected, because ssh is doing public-key cryptography to generate a session key, and public-key cryptography is slow. – Gilles Apr 1 '11 at 22:34
Sorry paused. Why doesn't this happen on my other (slower) server running the same OS? – Nat Ryall Apr 1 '11 at 22:35
A delay that manifests itself once, then not for a while, then once again, could be due to a cache effect. In particular it could be a slow, but cached, DNS lookup. But it's impossible to tell without more information. – Gilles Apr 1 '11 at 22:35
up vote 2 down vote accepted

Most of the times, a annoying small delay when initiating a connection, is due to reverse dns not working. Check your server's primary/secondary dns entries in its /etc/resolv.conf and whether they work as expected. As @Shawn J, Goff suggested you can test or work around this by manually entering the ip -> hostname entries of your boxes to their /etc/hosts files.

If that doesn't solve the problem, then check the network settings, it is possible to have the wrong gateway or the wrong netmask configured and still be able to use the internet, but not with optimal functionality.

Next step is to check the arp table with arp -n (for maybe duplicate entries). Check arping -I ethX ip.add.re.ss. If you have duplicated an ip of a machine that is mostly idle, then it is possible to have long delays when connecting and rare disconnects when connected.

Have sudo tcpdump -ni ethX running on a terminal during all the testings and watch for dns traffic, icmp messages or arp packets.

Last (and least probable), cabling or nic problems. Look for Link Up/Downs on dmesg or /var/log/kern.log. Create some traffic and watch for retransmits in tcpdump's output or if error counters are increasing in ifconfig ethX output.

share|improve this answer
It was the DNS lookup, as suspected. In my /etc/nsswitch.conf I had to change: hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 to hosts: files dns. – Nat Ryall Apr 11 '11 at 10:54
I had the same problem, and Nat's solution worked for me. However, now I am at least curious about the reason for this change. – Mr. Shickadance May 9 '11 at 12:37

This can be caused by sshd doing DNS lookups, especially when using SSH keys. You can mediate this by putting entries for your server system's name and your client system's name in /etc/hosts.

See http://psomas.wordpress.com/2009/10/19/sshd-reverse-dns-lookup/ for a little more depth.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.