I had a similar issue, which I solved by changing the DHCP settings of my router to give my local network a domain and the static DNS entries to put each host in that domain.
However, I found a few forum postings that describe a similar issue that had subtly different symptoms and a different solution (a registry change), so I'm going to describe my problem in detail to distinguish it from that.
My Issue
I had recently gotten a new router (a Mikrotik), and configured it assign each host on my network a static IP and give each host a local DNS hostname (and only a hostname). This worked fine from UNIX/Linux/Mac OS X, but Windows had problems with it.
On Windows, I could not ping some hosts by name, even though I could look them up via nslookup and ping them by IP:
C:\>nslookup router
Server: router
Address: 192.168.22.1
Non-authoritative answer:
Name: router
Address: 192.168.22.1
C:\>ping router
Ping request could not find host router. Please check the name and try again.
C:\>ping 192.168.22.1
Pinging 192.168.22.1 with 32 bytes of data:
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.22.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\>nslookup overkill
Server: router
Address: 192.168.22.1
Non-authoritative answer:
Name: nas_server
Address: 192.168.22.5
But strangely, some others worked:
C:\>ping nas_server
Pinging nas_server [192.168.22.5] with 32 bytes of data:
Reply from 192.168.22.5: bytes=32 time<1ms TTL=64
Reply from 192.168.22.5: bytes=32 time<1ms TTL=64
Reply from 192.168.22.5: bytes=32 time<1ms TTL=64
Reply from 192.168.22.5: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.22.5:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\>
I used Wireshark to investigate further, and found that the ping command was not causing any DNS packets to get sent, only NetBIOS Name Service packets. This would fail for my router, but it would succeed for my NAS server (because the NAS was running Samba). The nslookup used DNS, which is why it worked for everything.
Wireshark capture from ping:
The root problem was that Windows uses the NetBIOS Name Service instead of DNS in certain cases (like when the host does not have a domain).
My Solution
Note: the screenshots are from my router's configuration screen, but they illustrate general concepts.
I configured my DHCP server to tell all hosts that they were part of a domain:
Then I configured all my static DNS entries to place all hosts in this domain:
Then I cleared all DHCP/DNS information from Windows:
C:\>ipconfig /release
C:\>ipconfig /renew
C:\>ipconfig /flushdns
And everything worked!
C:\>ping router
Pinging router.localnet [192.168.22.1] with 32 bytes of data:
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Reply from 192.168.22.1: bytes=32 time<1ms TTL=64
Ping statistics for 192.168.22.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
C:\>