Link to home
Start Free TrialLog in
Avatar of rfr1tz
rfr1tz

asked on

How to use nslookup if the machine does not access to any DNS server?

Hi,

We've a DB server (Oracle) running on a Sun Solaris. This server has no access to any DNS server. The only thinng it has for host names lookup is the file /etc/hosts. Inside the file /etc/nsswitch.conf, there is the line "hosts: dns files" So, a service to lookup

My first question: Is it possible to make nslookup look into the file /etc/hosts for the host name lookup, instead of using a DNS server?

If it is not possible, can I think that the line "host: dns files" inside nsswitch.conf has no effect on nslookup?

If you know some way to make nslookup to use /etc/hosts for host name resolution, please give some help. Any help is appreciated.

Thanks,

Rfr1tz
Avatar of tfewster
tfewster
Flag of United Kingdom of Great Britain and Northern Ireland image

Change the line to read
hosts: files
Oops, `nslookup` on Solaris only works for DNS, and  so will always fail; But "normal" functions like gethostbyname will obey the rules in nsswitch.conf
With nslookup there is an option to nslookup on a specific name server and bypass the resolv.conf.

the syntax is:

nslookup  <host>  [ nameserver ]

Hope this helps
Avatar of rfr1tz
rfr1tz

ASKER

Thanks for all the info.
We cannot set this up as a DNS server due to security concern. There is a suggestion that writing a script named "nslookup" that actually reads the lines of /etc/hosts and do the job exactly the same as nslookup (of course, we've to rename the real nslookup).

However, I've no idea about how to start wrting this script. If you have some ideas about how to create this kind of script, please help.

Thanks a lot,

Rfr1tz

ASKER CERTIFIED SOLUTION
Avatar of tfewster
tfewster
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial