Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding DNS and gateway assigned to server 1

Status
Not open for further replies.

octotech

Technical User
Jun 22, 2001
5
US
Hi,

As you could probably tell from my question I'm not too Linux saavy...

I need to find the DNS and gateway assigned to various remote servers for record keeping purposes. Unfortunately because of my telnet program, I can either not navigate through linuxconf or the program bombs out. I can get the IP and mask from ifconfig but how do I find the other info?

TIA

Octotech
 
Hi,

The nameservers should be in /etc/resolv.conf
in the order of primary, secondary (i.e primary dns is first address shown). Simply 'cat /etc/resolv.conf' to display it from your telnet session.

The file /etc/host.conf may have an 'order' directive that influences the name resolution order. E.g. 'order bind,hosts' means use DNS first then fallback to /etc/hosts .

You can find the gateway by doing a 'netstat -nr' command. This should be self-explanatory. The gateway(s) are shown under 'gateway' and also as indicated in by a 'G' under Flags.

Regards..

 
You can automate this process if you would like with expect, say if you have over 5 or 6 remote servers this would save you some time.

Otherwise you could get the info by telnetting to the remote server and
the nameserver info is
recorded in resolv.conf:
hard way:
cat resolv.conf | awk ' /nameserver/ {
print $0 }'

Or from your linux desktop query the remote servers domain server:
EZ way:
dnsquery server.remote.com(you will need bindutils installed) or just host -t NS
remote.com

The default gateway can be ascertained by
telnetting to the remote box and issuing the
route , or route -v command.
There are other ways to find out a machines
gateway remotely but they are fairly intrusive and may be filtered.

BYE.

 
The order of files,dns, etc is also stored often in the
/etc/nsswitch.conf file... try there alao :)

-john
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top