Solved

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

Posted on 2007-11-24
5
3,522 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can use conditional statements using Python.
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
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.
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.

776 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