Loading ...
Sorry, an error occurred while loading the content.

Re: default dns server?

Expand Messages
  • wlanie01
    ... Is this what you need? Not sure I understand what you are trying to do... http://www.net-dns.org/
    Message 1 of 3 , Mar 20, 2009
    • 0 Attachment
      --- In perl-beginner@yahoogroups.com, "Brian" <brianlamere@...> wrote:
      >
      > I'm trying to find out what my primary dns server is, within a perl script. It just happens to be an AD server, and I need to point to it as a AD machine instead of a dns machine, but I thought I'd look up primary dns instead of hard-coding a name or IP. Any suggestions? can't seem to find an answer on google; lots of non-relevant results.
      >
      > Thanks!
      > Brian
      >
      Is this what you need? Not sure I understand what you are trying to do...
      http://www.net-dns.org/
    • Brian
      sortof, closest I could find there was Net::DNS::ToolKit::get_ns but that didn t want to work on my machine. basically - the system knows what it s name
      Message 2 of 3 , Mar 20, 2009
      • 0 Attachment
        sortof, closest I could find there was Net::DNS::ToolKit::get_ns but that didn't want to work on my machine.

        basically - the system knows what it's name servers are. I just want the script to know too, without just doing something like:

        awk '/server/{print $2}' /etc/resolv.conf

        I prefer not to use qx// or system() if I don't have to?

        I did try:

        http://search.cpan.org/~olaf/Net-DNS-0.65/lib/Net/DNS.pm#Find_the_nameservers_for_a_domain.

        but what that seems to actually do is query the nameserver for a list of nameservers. How does it query the nameserver? It just knows what my ns is from /etc/resolv.conf, and asks that guy. I don't want that, I just want it to tell me what is in resolv.conf. I'd like something that works well enough on other platforms too; I don't want to assume an /etc/resolv.conf

        maybe I'm just making it more complicated than it needs to be, though?

        Brian

        but that gave me the roothints servers - it responded with

        --- In perl-beginner@yahoogroups.com, "wlanie01" <wlanie01@...> wrote:
        >
        > --- In perl-beginner@yahoogroups.com, "Brian" <brianlamere@> wrote:
        > >
        > > I'm trying to find out what my primary dns server is, within a perl script. It just happens to be an AD server, and I need to point to it as a AD machine instead of a dns machine, but I thought I'd look up primary dns instead of hard-coding a name or IP. Any suggestions? can't seem to find an answer on google; lots of non-relevant results.
        > >
        > > Thanks!
        > > Brian
        > >
        > Is this what you need? Not sure I understand what you are trying to do...
        > http://www.net-dns.org/
        >
      Your message has been successfully submitted and would be delivered to recipients shortly.