Fixing “ldap_bind: Can’t contact LDAP server” error

If, whilst trying to configure and test OpenLDAP it fails upon attempting to perform an initial query of the LDAP server along the lines of:

ldap_connect_to_host: getaddrinfo failed: Name or service not known
ldap_bind: Can't contact LDAP server

the most common issue is incorrect naming with /etc/hosts . Of course, this is assuming you know you have your configuration setup right! Additional debug information during the query process can be obtained by adding “-d 255” to your command.

Within your hosts file, it is common to have something like: fatcontroller.homelinux fatcontroller

which would cause OpenLDAP to fail with the above error message. Instead, the full FQDN must be set, as per the LDAP configuration itself, such as: fatcontroller

Now, when trying to perform an initial query, it will be successful.


Senior Content Development for Microsoft writing about Azure Kubernetes Service (AKS). Model train nerd. Occasionally I play video games.

2 comments on “Fixing “ldap_bind: Can’t contact LDAP server” error
  1. harry says:
    Mozilla 1.6a Linux
  2. kapil says:
    Mozilla Firefox 3.0 Windows XP

Leave a Reply

Your email address will not be published. Required fields are marked *