The nslookup command has been deprecated. Instead, a new, more powerful command – dig (domain information groper) – should be used. On some newer Linux servers the nslookup command may not be even available.

Here is an example; to check the name resolution of the host oracle.com, you use the following command:

# dig oracle.com
; DiG 9.2.4  oracle.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<-  opcode: QUERY, status: NOERROR, id: 62512
;; flags: qr rd ra; QUERY: 1,  ANSWER: 1, AUTHORITY: 8, ADDITIONAL: 8
;oracle.com.                    IN      A
oracle.com.             300     IN      A
oracle.com.             3230    IN      NS      ns1.oracle.com.
oracle.com.             3230    IN      NS      ns4.oracle.com.
oracle.com.             3230    IN      NS      u-ns1.oracle.com.
oracle.com.             3230    IN      NS      u-ns2.oracle.com.
oracle.com.             3230    IN      NS      u-ns3.oracle.com.
oracle.com.             3230    IN      NS      u-ns4.oracle.com.
oracle.com.             3230    IN      NS      u-ns5.oracle.com.
oracle.com.             3230    IN      NS      u-ns6.oracle.com.
ns1.oracle.com.         124934  IN      A
ns4.oracle.com.         124934  IN      A
u-ns1.oracle.com.       46043   IN      A
u-ns2.oracle.com.       46043   IN      A
u-ns3.oracle.com.       46043   IN      A
u-ns4.oracle.com.       46043   IN      A
u-ns5.oracle.com.       46043   IN      A
u-ns6.oracle.com.       46043   IN      A
;; Query time: 97 msec
;; WHEN: Mon Dec 29 22:05:56  2008
;; MSG SIZE  rcvd: 328
From the mammoth output, several things stand out. It shows that the command sent a query to the nameserver and the host got a response back from the nameserver. The name resolution was also done at some other nameservers such as ns1.oracle.com. It shows that the query took 97 milliseconds.

If the size of the output might not make it all that useful, you can use the +short option to remove all those verbose output:

# dig +short oracle.com
You can also use the IP address to reverse lookup the host name from the IP address. The -x option is used for that.

# dig -x
The +domain parameter is useful when you are looking for a host inside a domain. For instance, suppose you are searching for the host otn in the oracle.com domain, you can either use:

# dig +short otn.oracle.com
Or you can use the +domain parameter:

# dig +short +tcp  +domain=oracle.com otn

Usage for the Oracle User

The connectivity is established between the app server and the database server.
The TNSNAMES.ORA file, used by SQL*Net may look like this:

prodb3 =
  (description =
    (address_list =
      (address = (protocol = tcp)(host = prolin3)(port = 1521))
    (connect_data =
      (sid = prodb3)

The host name prolin3 should be able to be resolved by the app server. Either this should be in the /etc/hosts file; or the host prolin3 should be defined in the DNS.

To make sure the name resolution works and works correctly to point to the right host, you can use the dig command.

With these two commands you can handle most of the tasks involved with network in a Linux environment.


Every reachable host in a network should have an IP address, which identifies it uniquely in the network. In the internet, which is a big network anyway, IP addresses allow the connections to reach servers running Websites, e.g. www.oracle.com. So, when one host (such as a client) wants to connect to another (such as a database server) using its name and not the IP address, how does the client browser know which IP address to connect to?

The mechanism of translating the host name to IP addresses is known as name resolution. In the most rudimentary level, the host has a special file called hosts, which stores the IP Address – Hostname pairs. Here is an example file:

# cat /etc/hosts
# Do not remove the following  line, or various programs
# that require network  functionality will fail.       localhost.localdomain       localhost   prolin1.proligence.com      prolin1   prolin2.proligence.com      prolin2
This shows that the hostname prolin1.proligence.com is translated to The special entry with the IP address is called a loopback entry, which points back to the server itself via a special network interface called lo (which you saw earlier in the ifconfig and netstat commands).

Well, this is good, but you can’t possibly put all the IP addresses in the world in this file. There should be another mechanism to perform the name resolution. A special purpose server called a nameserver performs that role. It’s like a phonebook that your phone company provides; not your personal phonebook. There may be several nameservers available either inside or outside the private network. The host contacts one of the nameservers first, gets the IP address of the destination host it want to contact, and then attempts to connect to the IP address.

How does the host know what these nameservers are? It looks into a special file called /etc/resolv.conf to get that information. Here is a sample resolv file.

; generated by  /sbin/dhclient-script
search proligence.com

How do you make sure that the name resolution is working fine for a specific host name? In other words, you want to make sure that when the Linux system tries to contact a host called oracle.com, it can find the IP address on the nameserver. The nslookup command is useful for that. Here is how you use it:

# nslookup oracle.com
Non-authoritative answer:
Name:   oracle.com

Let’s dissect the output. The Server output is the address of the nameserver. The name oracle.com resolves to the IP address The name was resolved by the nameserver shown next to the word Server in the output.

If you put this IP address in a browser– instead of http://oracle.com–the browser will go the oracle.com site.

If you made a mistake, or looked for a wrong host:

# nslookup oracle-site.com
** server can’t find  oracle-site.com: NXDOMAIN

The message is quite clear: this host does not exist.

(Extracted from oracle technet notes author Arup Nanda)