How to find out which server is LDAP/NIS master?

I have some scripts where I go and do some LDAP/NIS queries to report on users on Unix servers. What I am trying to figure out is, how do I know which server is the LDAP? The configs have been in place long before I took over so was hoping someone had some insight on how to figure this out. I must admit it has been quite some time since I have touched either, but for the life of me can't remember which files to check to figure this out.

I do know that for NIS I can use the "ypwhich" command to figure out which is the master device and then compare it to the local hostname, what I can't figure out is how to do something similarly slick in the LDAP world.

What OS are you using?
And what LDAP client does the system use?

You could just look at the configuration file, to know which servers the LDAP client uses. If the LDAP client software is configured to perform a permanent bind you could also look at netstat to see which servers are being communicated with on ports 389/tcp and 636/tcp.