Solved

How to make nslookup works without dns server?

Posted on 2004-08-06
10
1,591 Views
Last Modified: 2013-12-15
Hi,

We've a DB server. This server doesn't have any access to DNS server. The only thing it has that can be used with nslookup is /etc/hosts. However, we don't know how to set up nslookup so that it will work without DNS server.

If you know how to set up this, please help. Any help will be appreciated.

Thanks,

Rfr1tz
0
Comment
Question by:rfr1tz
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 3

Author Comment

by:rfr1tz
ID: 11737024
Hi,

Can nslookup uses the file "/etc/hosts" to determine host names?
If the file /etc/nsswitch.conf has the line: hosts: dns files, can nslookup uses the file /etc/hosts to determine the host name.

Is it possible to make nslookup uses the file /etc/hosts if they found that there is no dns server access?

Thanks a lot for any help,

Rfr1tz
0
 
LVL 36

Assisted Solution

by:grblades
grblades earned 40 total points
ID: 11737457
Hi rfr1tz,
No nslookup only does lookups against a nameserver.
0
 
LVL 51

Assisted Solution

by:ahoffmann
ahoffmann earned 40 total points
ID: 11739663
2nd grblades
but most applications use the system's resolver library which can be tweaked to use /etc/hosts in /etc/nsswitch.conf (see hosts: entry)
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 44

Assisted Solution

by:Karl Heinz Kremer
Karl Heinz Kremer earned 40 total points
ID: 11740067
You probably don't want to access /etc/hosts from nslookup, what you want to do is use /etc/hosts to resolve the names your DB server has to use. This is connected to, but considerably different from nslookup. nslookup is the Name Services lookup (or Name Server lookup) tool, and does always connect to a DNS server. If I remember correctly, in the "old days" it actually came with and only with the bind distribution (this is one of the more important DNS servers).

Most systems actually come already configured to use /etc/hosts for name lookup without having to mess with /etc/nsswitch.conf. Try this: Add a host entry to /etc/hsots and then try to access this host with a ping command (e.g. ping host2). Do you get a response from the other host? If you do, your system is already setup correctly.

0
 
LVL 12

Accepted Solution

by:
mburdick earned 60 total points
ID: 11769065
To combine previous answers into one:

nslookup is a tool designed to query name servers for information. That's it's main purpose. It is not used by the OS to translate names to addresses.

It sounds like you want to be sure that your DB server, which has no access to DNS, can translate host names to addresses. You can accomplish this with two steps:

First, tell the OS to use the /etc/hosts file for resolution as its primary source of information. Modify your /etc/nsswitch.conf file so that the "hosts" line lists files before dns (or files only).

Second, place appropriate entries in the /etc/hosts files for the systems you need to resolve.

10.0.15.4     host1     host1.mydomain.com

Once all pieces are in place, try to ping a host by short name (host1) and long name (host1.mydomain.com) to be sure the resolve happens immediately and correctly. If something doesn't seem to be working properly, restart the system once and test again.
0
 

Assisted Solution

by:marcoakr
marcoakr earned 35 total points
ID: 11791379
You can use the program 'named-checkconf' to check the syntax (but not the semantics) of the named (BIND) configuration file :

[user@localhost]# named-checkconf  /etc/named.conf

on a freeBSD system.

Read a VERY good step by step tutorial at :

http://www.marcorodrigues.com/tutorials/DNS-Sendmail.pdf

for further explanations...

Good luck!
0
 
LVL 1

Assisted Solution

by:hazmatt81
hazmatt81 earned 35 total points
ID: 11833879
Yes, as others have said nslookup is used to look at a DNSserver, however if you put your entries into your /etc/hosts file such as:
192.168.0.1   database1.mydomain.com

the database server will find it just fine.
0
 
LVL 3

Author Comment

by:rfr1tz
ID: 11854991
Hi all,

Thanks so much for all your help.
Actually, the scenario is like this: We've an Oracle DB server. In their support, Orache insists that we must have nslookup enabled and working on the server. At the same time, due to requirments from senior system architects, we must not start DNS service on the server due to the security concern.

And it seems that we cannot compromise these 2 requirements: nslookup enabled & DNS service must be OFF.

If you've any idea about this scenarion, please give some help,

Thanks again,

Rfr1tz



0
 
LVL 36

Expert Comment

by:grblades
ID: 11855109
Can you edit the /etc/resolv.conf file and point it to another DNS server somewhere?
0
 
LVL 12

Expert Comment

by:mburdick
ID: 11867077
nslookup does NOT require that the DNS service be running locally on the machine. It only requires the ability to *communicate with* and DNS server, and that can be another machine.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linux redhat 7.2 10 89
bash file 10 49
lunix and unix command 21 86
The better OS Architecture 13 66
I am a long time windows user and for me it is normal to have spaces in directory and file names. Changing to Linux I found myself frustrated when I moved my windows data over to my new Linux computer. The problem occurs when at the command line.…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question