Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 02-20-2005, 09:19 AM   #1
Registered: Jul 2004
Posts: 40

Rep: Reputation: 15
nslookup - secondary (alternate) nameserver

I have a need to determine the secondary (and even alternate) nameservers that are provided by my (or any) isp. These are returned, of course, when a DHCP request is made, however I want to be able to query for these in cases where the nameservers are not known and where I am not making a DHCP request. (In my particular case, I'm working on an embedded project which in some cases will act as a NAT router (between customer internet modem and another router or standalone equipment). In cases where my device has a static address on the wan side, i don't want to burden a customer with having to make dns ip entries, etc.

nslookup does a nice job of returning the (assumed: primary) nameserver that was used in the lookup request. Example:

[root@SolarWaveAEM /]296# nslookup


Wonderful. But my ISP also has returned this information (presented on the Linksys router's "status" page):

Static DNS1:
Static DNS2:
Static DNS3:

As the nslookup return indicates, the "Static DNS2" entry above was used for the search. I assume that, despite what Linksys says, it's the "primary" entry, not the alternate.

At any rate, what I want to do is to use or build a utility that will make an appropriate query and get back a nameserver list. nslookup does not seem to have an option for this.

Any ideas out there?
Old 02-20-2005, 09:48 AM   #2
Registered: Dec 2004
Location: Western Pennsylvania, USA
Distribution: Red Hat
Posts: 150

Rep: Reputation: 15
In nslookup enter:

set type=ns

That will list all the nameservers for that domain.

You can also do the same thing with the dig command in Linux:

dig domainname.whatever ns

The list of nameservers for that domain will be returned.
Old 02-20-2005, 10:00 AM   #3
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
I'm not sure how this is going to work because I think you will need to have specified a dns server in order to use nslookup in the first place. Why not just specify some of the free root dns servers?

If you want to query the dhcp server then create a "/usr/sbin/getdns-client" script with:

for nameserver in $new_domain_name_servers; do
 echo DNS$num: $nameserver
Then just run:
dhclient -q -sf /usr/sbin/getdns-client


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
nslookup phsythax Linux - Software 5 11-19-2005 03:15 AM
Nslookup redhatlover Red Hat 3 05-08-2004 08:25 AM
nslookup ninen Linux - Software 1 05-23-2003 09:07 PM
secondary nameserver dilberim82 Linux - Networking 2 10-24-2001 07:47 AM
NSlookup Nezar Linux - Networking 1 08-05-2001 04:43 AM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:01 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration