Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm new to LDAP and I already configured accounts with LDAP so I can login on few computers with LDAP.

Now I would like to add some host names to LDAP. In /etc/nsswitch.conf I changed:

hosts:          files dns ldap

But I have no idea how to add anything to LDAP database so it could resolve some names. I tried google but I couldn't find anything helpful.

On example, how to add this:

192.168.1.1    node1
share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

I already figured it out with help of migrationtools (ubuntu package).

First, create file add_hosts.ldif:

dn: ou=Hosts,dc=example,dc=net
objectClass: organizationalUnit
ou: Hosts

Load it with:

ldapadd -D cn=admin,dc=example,dc=net -W -f add_hosts.ldif

Above steps should be done only once.

Then create file node1_host.ldif:

dn: cn=node1,ou=Hosts,dc=example,dc=net
objectClass: top
objectClass: ipHost
objectClass: device
ipHostNumber: 192.168.1.1
cn: node1
cn: n1

I added second cn so it can resolve both node1 and n1. If you want to add another host, just create another file node2_host.ldif and load it into LDAP.

share|improve this answer
add comment

Your Answer

 
discard

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.