Search code examples
phpdnsnameserversdig

Receiving nameserver set by passing one NS


Is there a way to recieve the complete nameserver set by passing just one nameserver of the set?

For example I pass the the Nameserver: ns1.sedoparking.com and as a result I would expect

ns1.sedoparking.com + ns2.sedoparking.com

I tried it already with the Pear function "Net_DNS_Resolver", DIG and dns_get_record("ns1.sedoparking.com", DNS_ANY, $authns, $addtl)

But I receive always the wrong nameservers.

Thank you a lot!


Solution

  • Since PHP's DNS functions do not allow you to specify which server to query, I'd just use dig (I have no previous experience with Net_DNS_Resolver), and query specifically for the NS records:

    dig ns1.sedoparking.com ns @ns1.sedoparking.com +noall +answer
    

    Outputs:

    ; <<>> DiG 9.7.1-P2 <<>> ns1.sedoparking.com ns @ns1.sedoparking.com +noall +answer
    ;; global options: +cmd
    ns1.sedoparking.com.    86400   IN  NS  ns1.sedoparking.com.
    ns1.sedoparking.com.    86400   IN  NS  ns2.sedoparking.com.
    

    However, it's somewhat rare the nameservers return NS records when you query them with their own name, so I'd just remove the ns1 part from the query to make sure:

    dig sedoparking.com ns @ns1.sedoparking.com +noall +answer
    

    The answer will be the same in both cases.