LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   hostname to IP address (https://www.linuxquestions.org/questions/linux-networking-3/hostname-to-ip-address-307277/)

bruse 03-29-2005 03:05 AM

hostname to IP address
 
i am using mandrake 10.0.
there are 12 computers connected in my network.
is there any way to find the IP address of the system using their hostname?

i know the hostname. with this how to find a IP address? and vice versa.

and from this IP address how to find the hostname?

please help me...

zeropash 03-29-2005 03:19 AM

host <machinename>
nslookup <machinename>

bruse 03-29-2005 03:30 AM

using that, is it possible for my system also?

because see the result..

[staff@Simlab-node5 staff]$ hostname
Simlab-node5.mit
[staff@Simlab-node5 staff]$ nslookup Simlab-node5.mit
;; connection timed out; no servers could be reached

[staff@Simlab-node5 staff]$


can u please help me..

zeropash 03-29-2005 06:05 AM

have you set up your DNS properly?
check the /etc/resolv.conf file
it should ahve some entry like
nameserver <ip_address>

if not find your DNS server and put the ip address there.

if that seems ok then have you set this machine up new?
i mean is this hostname new?
if so you need to put that entry into the DNS server.

Darin 03-29-2005 08:55 AM

user@mybox:~$ ping mybox
PING mybox.my.dyndns.org (192.168.0.1) 56(84) bytes of data.
64 bytes from mybox.my.dyndns.org (192.168.0.1): icmp_seq=1 ttl=64 time=0.21
8 ms
64 bytes from mybox.my.dyndns.org (192.168.0.1): icmp_seq=2 ttl=64 time=0.15
0 ms
...

dig [hostname]
and
dig -x [IP address]
work also, but they, like nslookup, require a functioning DNS server.

zeropash 03-29-2005 11:21 PM

even ping (or for that matter any program that can take a hostname) requires a DNS server (unless those hostname->ip translations are already present in the /etc/hosts file.)


All times are GMT -5. The time now is 12:51 AM.