[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1931
  • Last Modified:

How to make nslookup works without dns server?

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
rfr1tz
Asked:
rfr1tz
  • 2
  • 2
  • 2
  • +4
6 Solutions
 
rfr1tzAuthor Commented:
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
 
grbladesCommented:
Hi rfr1tz,
No nslookup only does lookups against a nameserver.
0
 
ahoffmannCommented:
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
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
Karl Heinz KremerCommented:
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
 
mburdickCommented:
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
 
marcoakrCommented:
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
 
hazmatt81Commented:
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
 
rfr1tzAuthor Commented:
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
 
grbladesCommented:
Can you edit the /etc/resolv.conf file and point it to another DNS server somewhere?
0
 
mburdickCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 2
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now