Solved

how to know hostname , If we have IP address in Unix OS

Posted on 2007-11-24
5
3,508 Views
Last Modified: 2013-12-16
Dear experts ,

In the unix operations system, if the we have ipaddress of the machine how to know the host name of that machine

thanks for your efforts in advance answering for this  questions
0
Comment
Question by:mansur_mca
  • 2
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 100 total points
ID: 20343026
Hi,

run the command

ifconfig -a

This command will list the interfaces on the system with info about its ip addresses, etc.

Also, you can look in /etc/hosts where the server name along its ip address is added.

0
 
LVL 2

Assisted Solution

by:mikemsd
mikemsd earned 25 total points
ID: 20343065
Also, depending on your distribution, you can run the command:

hostname

from the command prompt, and it will return your hostname.
0
 
LVL 1

Author Comment

by:mansur_mca
ID: 20343089
Happy to see you omarfarid  you reacted so soon.

I mean to say  , If we have hostname of server ,  can easily able to  find IP by the just ping request to Host name , My  requirement is other way round ( Ip address to hostname).
Consider I am  simple user in domain network , not as admin .
thanks ...to u
0
 
LVL 40

Expert Comment

by:omarfarid
ID: 20343131
Hi,

Mansur:

When you ping a hostname / servername then the resolution is either done from /etc/hosts or dns.

This depends on configuration of

- /etc/resolv.conf
- /etc/nsswitch.conf

Now, for the mapping of ip address to hostname / server name, then you either get it from /etc/hosts

or from dns if that ip address is configured on reverse lookup domain.

If you have a dns server and the reverse lookup of a range of ips is delegated to that server, then you can configure it to do so.

The reverse lookup of ips is under the domain in-addr.arpa

e.g. if you have a network 192.168.1 then the reverse lookup for it will be under the domain 1.168.192.in-addr.arpa
0
 
LVL 2

Expert Comment

by:mikemsd
ID: 20343133
Again, depending on distribution and tools installed, to do a reverse lookup of an IP address, perform either:

nslookup <ip address>

or

dig -x <ip address> +short
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The purpose of this article is to demonstrate how we can use conditional statements using Python.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
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 video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now