Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2007-11-24
5
Medium Priority
?
3,565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 40

Accepted Solution

by:
omarfarid earned 300 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 75 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses

610 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