I've installed LDAP on an Ubuntu 16.04 machine, using this command:

sudo apt install slapd ldap-utils

This is my config file /etc/ldap/ldap.conf

# LDAP Defaults

# See ldap.conf(5) for details
# This file should be world readable but not world writable.

BASE    dc=domain,dc=local
URI     ldap://domain.local:389

#SIZELIMIT      12
#TIMELIMIT      15
#DEREF          never

# TLS certificates (needed for GnuTLS)
#TLS_CACERT     /etc/ssl/certs/ca-certificates.crt

I've checked status of LDAP, it's running, and I don't have any firewall running at all on the server in question:

enter image description here

However, when I run ldapsearch -x it tells me:

ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Here is the debug output:

ldap_new_connection 1 1 0
ldap_connect_to_host: TCP domain.local:389
ldap_new_socket: 4
ldap_prepare_socket: 4
ldap_connect_to_host: Trying
ldap_pvt_connect: fd: 4 tm: -1 async: 0
attempting to connect: 
connect errno: 111
ldap_close_socket: 4
ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Here is my hosts file, and if I ping that domain it returns the IP:       localhost    domain.local

ldapsearch simply cannot open a TCP connection to port 389.

There could be many reasons for that (excluding the ones you already excluded in your question):

  • firewalls in between
  • slapd does not really listen on IP address (check with netstat -tulpn)

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.