Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Networking
User Name
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.


  Search this Thread
Old 03-13-2012, 12:09 PM   #1
Registered: Jan 2002
Location: UK
Distribution: Desktop - Ubuntu, Server - Debian, CentOS
Posts: 72

Rep: Reputation: 15
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.
Old 03-13-2012, 12:18 PM   #2
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252

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.

Last edited by xeleema; 03-13-2012 at 12:20 PM.
Old 03-13-2012, 12:23 PM   #3
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,382
Blog Entries: 15

Rep: Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403Reputation: 1403
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.
Old 03-13-2012, 12:31 PM   #4
Registered: Jan 2002
Location: UK
Distribution: Desktop - Ubuntu, Server - Debian, CentOS
Posts: 72

Original Poster
Rep: Reputation: 15
(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.


debian, windows

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 2000 machines with a Linux Server tubatodd Slackware 2 03-30-2007 02:54 PM
windows 98 m/c ping to ip address of red hat server but fails to ping hostname ravilohot Linux - Networking 2 09-07-2004 04:57 AM
Linux machines cant ping server..Windows can. NetAX Linux - Networking 1 05-21-2004 09:55 AM
problem seeing Samba server from Windows machines kenviro Linux - Networking 11 08-18-2003 12:04 AM
Can't ping windows machines by hostname explorer Linux - Networking 10 03-06-2003 12:44 PM > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration