2

When I ping my Linux server (running in a VM on my Windows7 host) with the following command:

 ping -a 192.168.56.***

I get the results shown below. Why isn't it resolving my server's name?

Pinging 192.168.56.*** with 32 bytes of data:

Reply from 192.168.56.***: bytes=32 time<1ms TTL=64

Reply from 192.168.56.***: bytes=32 time<1ms TTL=64

Reply from 192.168.56.***: bytes=32 time<1ms TTL=64

Reply from 192.168.56.***: bytes=32 time<1ms TTL=64

where is the problem?

terdon
  • 234,489
  • 66
  • 447
  • 667
a avali
  • 21
  • 1
  • 1
  • 3
  • 2
    use nslookup to map from IP to name (provided your DNS server or /etc/hosts are up to date). Note however, there is no such thing as a "link" between IP and hostname. – Archemar Mar 12 '15 at 06:40
  • Are you pinging from a Windows client or a Linux client? (sorry I have to ask) The answer will allow us to help you better. – mdpc Mar 12 '15 at 06:53
  • i have not dns server, my linux server is a virtual machine in virtual box and i can not resolve it's name. – a avali Mar 12 '15 at 06:54
  • i ping my linux server with a win 7 client. as i mentioned my server is a virtual machine in virtual box – a avali Mar 12 '15 at 06:56
  • You'll not be able to see a hostname then unless you put this in your clients' /etc/hosts file (or windows equivalent). Also, I suspect that you are using DHCP for the IP assignment in Virtual Box...so the actual IP will vary. Thus the IP number would only be temporary and the /etc/hosts file would have to be changed. – mdpc Mar 12 '15 at 06:57
  • i edit /etc.hosts and /etc/sysconfig/network and set the host name, the IPs are static, there to DHCP server. – a avali Mar 12 '15 at 07:00
  • in virtual box when i ping a win7 to another win7 the target win7'name is shown, but linux noppppppppppp – a avali Mar 12 '15 at 07:04
  • 2
    Relevant: [ping -a sometimes returns host name and sometimes returns FQDN. Why? Does this mean DNS is corrupt somehow?](http://serverfault.com/q/560589) – terdon Mar 12 '15 at 11:27
  • You don't need to censor that IP. That is part of a non-routable private block and knowing that last number doesn't enable anyone to know anything about you. – casey Oct 22 '15 at 02:31

2 Answers2

4

The output looks perfectly normal.

Many (most?) ping implementations don't do reverse DNS lookup. If you pass an IP address, it displays an IP address.

After all, why would it bother with DNS? Pinging only requires the IP address. If you pass a host name, ping does a DNS lookup to get the address. If you pass an IP address, ping just uses the IP address.

If you want to perform a reverse DNS lookup, use a tool whose job it is to work with DNS, such as host 192.168.56.42 or nslookup 192.168.56.42. Note that in order for a machine to know another machine's name, it isn't enough to set the name in that machine's /etc/hosts: that won't let other machines know. The normal way to declare the name of a machine on Unix systems (like most of the world outside pre-Internet protocols) is to register it with DNS. Some VM software will automatically provide DNS services to virtual machines and serve names declared in /etc/hosts (or HOSTS.TXT on Windows) on the host. If yours doesn't, set up a DNS server (see this answer for a possible way).

There may be a way for Linux to support Windows's network discovery protocols (NetBIOS?) but I'm not familiar with that so I can't tell you how. If it can be made to work, you'll probably have to set up Samba on the Linux machine and configure it to advertise itself on the network (Windows tends to default wide open but Linux defaults discreet so you'll need to actively turn on name broadcasting).

Gilles 'SO- stop being evil'
  • 807,993
  • 194
  • 1,674
  • 2,175
0

there is no dns entry for that server in your dns zone.