How can I find out which server hosts LDAP on my windows domain?

后端 未结 3 1784
后悔当初
后悔当初 2020-12-22 21:18

I am trying develop an application (C#) to query an LDAP server. I don\'t know the actual server named to query - is there a way to find out using standard windows tools or

3条回答
  •  礼貌的吻别
    2020-12-22 21:57

    If the machine you are on is part of the AD domain, it should have its name servers set to the AD name servers (or hopefully use a DNS server path that will eventually resolve your AD domains). Using your example of dc=domain,dc=com, if you look up domain.com in the AD name servers it will return a list of the IPs of each AD Controller. Example from my company (w/ the domain name changed, but otherwise it's a real example):

        mokey 0 /home/jj33 > nslookup example.ad
        Server:         172.16.2.10
        Address:        172.16.2.10#53
    
        Non-authoritative answer:
        Name:   example.ad
        Address: 172.16.6.2
        Name:   example.ad
        Address: 172.16.141.160
        Name:   example.ad
        Address: 172.16.7.9
        Name:   example.ad
        Address: 172.19.1.14
        Name:   example.ad
        Address: 172.19.1.3
        Name:   example.ad
        Address: 172.19.1.11
        Name:   example.ad
        Address: 172.16.3.2
    

    Note I'm actually making the query from a non-AD machine, but our unix name servers know to send queries for our AD domain (example.ad) over to the AD DNS servers.

    I'm sure there's a super-slick windowsy way to do this, but I like using the DNS method when I need to find the LDAP servers from a non-windows server.

提交回复
热议问题