-   Linux - Networking (
-   -   How to ping Windows 7 machines by name from Debian Server? (

keymoo 03-13-2012 01:09 PM

How to ping Windows 7 machines by name from Debian Server?
I have backuppc installed on my Debian server and I need to be able to resolve my Windows 7 machines on my home LAN by name. I have a machine called lanthanum, and if I ping it by name I get this:


PING lanthanum ( 56(84) bytes of data.
64 bytes from ( icmp_req=1 ttl=55 time=247 ms

Why is ping going out to the internet? Lanthanum's IP address is and it should resolve to that but it's not. I can ping lanthanum fine from windows machines. I've added "wins" to /etc/nsswitch.conf on the "hosts:" line and rebooted, but it's still not working. I have a DNS server on my home network. Any ideas? I don't want to configure the hosts file.

xeleema 03-13-2012 01:18 PM


Try using the "Fully Qualified Domain Name" (FQDN) of the Windows machine in question.
You should be able to undo the change to your nsswitch.conf file as well.

EDIT: If you do an 'nslookup lanthanum', and you're not "hitting" your local LAN first, your *NIX system's /etc/resolv.conf may need to be tweaked.

MensaWater 03-13-2012 01:23 PM

What is in your /etc/resolv.conf?

What does the "hosts" line in /etc/nsswitch.conf have in it other than wins? If you have DNS it seems you could set line to have dns and hosts. I've never used wins in nsswitch.conf so don't know if it should work and/or if it requires additional configuration (e.g. samba for user authorization) to work.

When you type a host name by default it will try whatever method is in nsswitch.conf first then the next one second then the last one so for example I typically have:
hosts: files dns
which tells it to look at /etc/hosts first then dns. (This allows me to override DNS entries at host level by specifying the host in /etc/hosts.)
A default example is:
hosts: db files nisplus nis dns
That would first look at a database, then at /etc/hosts then at nisplus then at nis and finally at dns to find the name.

The name you typed is the "short" name. The /etc/resolv.conf can tell DNS what domain to search as well as what DNS server to query. You probably got the internet default answer because either you have a domain to search specified that it found or you don't have any and it made its guess on what to look for based on whatever the stub resolver on Linux is designed to use by default. If the fully qualified domain name (FQDN) is something like: then you'd add as the search domain to resolv.conf so that when you did the DNS lookup for the short name it would know to try appending to get the FQDN.

keymoo 03-13-2012 01:31 PM


(smacks head) My local DNS server was not in there. I put it in there and all is fine now. Thanks for reading and thanks for the great replies.

All times are GMT -5. The time now is 01:35 PM.