LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 02-20-2005, 08:19 AM   #1
k1mgy
Member
 
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 solarwave.com
Server: boston2-qwest.bellatlantic.net
Address: 151.203.0.85

Name: solarwave.com
Address: 65.77.208.234

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

Static DNS1: 151.203.0.85
Static DNS2: 151.202.0.85
Static DNS3: 0.0.0.0

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, 08:48 AM   #2
cowanrl
Member
 
Registered: Dec 2004
Location: Western Pennsylvania, USA
Distribution: Red Hat
Posts: 150

Rep: Reputation: 15
In nslookup enter:

set type=ns
domainname.whatever

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, 09:00 AM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 64
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:
Code:
#!/bin/sh

num=0
for nameserver in $new_domain_name_servers; do
 num=$(($num+1))
 echo DNS$num: $nameserver
done
Then just run:
dhclient -q -sf /usr/sbin/getdns-client
 
  


Reply


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 02:15 AM
Nslookup redhatlover Red Hat 3 05-08-2004 07:25 AM
nslookup ninen Linux - Software 1 05-23-2003 08:07 PM
secondary nameserver dilberim82 Linux - Networking 2 10-24-2001 06:47 AM
NSlookup Nezar Linux - Networking 1 08-05-2001 03:43 AM


All times are GMT -5. The time now is 07:24 AM.

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