Setup is as follows, Ubuntu 8.04 server in DMZ running Mysql 5

Remote connections from php on windows machines outside the DMZ are taking 5 seconds to establish (at which point the speed of mysql is fast) Connections from localhost are "instant"

Sounds like a standard dns issue to me so I have enabled skip-name-resolve and confirmed that is working (the error file logged skipped user entries) we still see the 5 second delay though. I have also tried adding the clients (netbios names, is this right?) as entries in the hosts file and the problem persists

I have run a tcpdump and from what I can gather, it looks like it is trying to do a netbios lookup (although I have zero experience reading tcpdumps!) I would imagine that is failing since this server is the only thing in the DMZ

I'm a little confused as to where to go from here.

  • After studying the tcpdump more carefully, it seems that the mysql server was attempting to lookup netbios details from a mac server elsewhere on the network. It couldn't reach this due to the DMZ restriction. Samba on the mac seemed to be advertising itself as a workgroup master, and turning this off has stopped mysql trying a lookup there. Fiddleing with nsswitch.conf also helped with the time to establish so will mark @rvs answer as the closest. – Nick Downton Apr 28 '11 at 8:12

Huh. Interesting issue.

Take a look to /etc/nsswicth.conf - this file determines order of looking in system databases (users, passwords, hosts, etc). hosts: line should look like hosts: files dns <everything else>. You could also try to remove <everything else>.

  • Thanks, yes interesting! Hosts line in nsswitch looks like this hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 altering it as you suggested doesn't seem to change response speed – Nick Downton Apr 27 '11 at 10:33

5 seconds is just the right time to make name resolution (direct or reverse on either the server or the client) the probable culprit. Does ping (for instance) exhibit the same behavior?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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