1.9. Changing the LDAP and LDAPS Port Numbers

By default, Directory Server uses port 389 for the LDAP and, if enabled, port 636 for the LDAPS protocol. You can change these port numbers, for example, to run multiple Directory Server instances on one host.

Important

The new ports you assign to the protocols for an instance must not be in use by any other service.

1.9.1. Changing the Port Numbers Using the Command Line

Changing the port numbers from the command line requires to update the corresponding parameter of the instance's configuration. The following parameters define the port numbers in Directory Server:
  • nsslapd-port: Stores the port number the instance uses for the LDAP protocol.
  • nsslapd-secureport: Stores the port number the instance uses for the LDAPS protocol.
To change the port numbers of the LDAP and LDAPS protocol using the command line:
  1. Optionally, display the currently configured port numbers for the instance:
    # dsconf -D "cn=Directory Manager" ldap://server.example.com config get nsslapd-port nsslapd-secureport
    nsslapd-port: 389
    nsslapd-secureport: 636
  2. To change the LDAP port:
    1. Set the port for the LDAP protocol. For example, to set it to 1389:
      # dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-port=1389
      Successfully replaced "nsslapd-port"
    2. Set the ldap_port_t type for the LDAP port you assigned in the previous step:
      # semanage port -a -t ldap_port_t -p tcp 1389
  3. To change the LDAPS port:
    1. Set the port for the LDAPS protocol. For example, to set it to 1636:
      # dsconf -D "cn=Directory Manager" ldap://server.example.com config replace nsslapd-secureport=1636
      Successfully replaced "nsslapd-secureport"
    2. Set the ldap_port_t type for the LDAPS port you assigned in the previous step:
      # semanage port -a -t ldap_port_t -p tcp 1636
  4. Restart the instance:
    # dsctl instance_name restart

1.9.2. Changing the Port Numbers Using the Web Console

To change the port numbers of the LDAP and LDAPS protocol using the web console:
  1. Open the Directory Server user interface in the web console. See Section 1.4, “Logging Into Directory Server Using the Web Console”.
  2. Select the instance.
  3. To change the LDAP port:
    1. Open the Server Settings menu.
    2. On the Server Settings tab, fill the new port number into the LDAP Port field.
    3. Click Save.
  4. To change the LDAPS port:
    1. Open the Server Settings menu.
    2. On the General Settings tab, fill the new port number into the LDAPS Port field.
    3. Click Save.