Why can't I mount a win host by name (\\hostname) but can by ip (\\192.x.x.x)?

I have this problem all the time on my home network. Sometimes I can connect to systems using their name like this \hostname. However, sometimes that doesn’t work. When it fails, I can connect if I use the IP address like this \192.168.0.10. This causes issues with trying to access remote storage and printers since usually I have it configured as \hostname\printer.

Both systems are Win XP and they are both in the same workgroup (MSHOME). They are hard-wired to the same router.

Something interesting is that when I do a Start->Run and enter the \ipaddress, the resulting window that comes up has the title:

 Hostname (ipaddress)

So somehow the hostname is associated with the address.

When I try to connect using \hostname, the error that comes back is:

Windows cannot find '\\hostname'. Check the spelling and try again,
 or try searching for the item by clicking the Start button and then
clicking Search.

Any ideas on how I can debug this?

On your network youre using netbios name resolution to resolve hostnames. Its an uncentralized approach to name resolution and makes a random computer on the network a master browser. This computer could have been a laptop that was shut off. Ideally you want a 24/7 machine on the network for netbios to work properly.

On top of that netbios resolution only works through broadcast packets. If your router or anything on your network is filtering these packets or if your network is losing packets (common in wireless) then netbios wont work at all or will work sporadically.

Well, to be a bit nitpicky, it’s not “random;” master browser elections follow a pretty well-defined set of rules, starting with preference to higher versions of the OS and ending with the server with the lexically lowest name winning. And one event that forces an election datagram to be broadcast is when the sending computer can’t locate a master browser… which sort of suggests that the laptop that’s been turned off isn’t going to be an MB for too long. The only random event is the delay, after a won election, for sending out another election datagram.

But your basic thrust I agree with: it’s a netbios issue. If we have a problem with smb://hostname and we replace hostname with an FQDN (and that FQDN resolves correctly) then that should work just as well as an IP address.

If this is a small network with statically assigned IPs you could edit your lmhosts file in C:\Windows\system32\drivers\etc to manually map the IPs to hostnames.

Drat, missed the edit window:

If it doesn’t work after a reboot, you may have lmhosts lookup disabled in the advanced TCP/IP properties of your network connection.

Yeah, I know its not random, but for the end user it might as well be. Not to mention the subtleties of netbios elections might be a bit out of scope for this question.

Fascinating. I’ve always wondered about this.

So is it possible to force a particular, always-on machine to act as the preferred name server (or a “master browser”, I guess the term would be)?

And in the context of a local network, what would a FQDN be? I thought that only applied to the Internet and DNS, or am I mistaken?

Now that it’s been mentioned, I do think rebooting may be part of the problem. It usually is after some system has been rebooted that I start seeing the problem. I assume that the problem is when I reboot the master and it loses any info it had about the other hosts. Is there a way to have a failing host re-broadcast it’s name?

Interesting. I hadn’t thought of doing this. I’ll give it a try.

Yes. Usual caveats about using REGEDIT, but if you have a preferred candidate for the job, set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters\IsDomainMaster to TRUE.

Sure, a local network can have a FQDN. It might be a tad unusual for a home system, but not unheard of – I have a local AD domain in my house, as well as Linux boxes that authenticate using LDAP. So my DC’s are authoritive for my local DNS zones, and I have FQDN’s that don’t exist outside my house but are fully resolvable and reachable internally.

Neat. Thank you. What happens if 2+ machines all have that set?

Ahh, ok. Is something similar available via regular ol’ Windows Home Networking?

If there’s a tie in one set of criteria, the competing machines move on to the next set of criteria. Ultimately, as I mentioned above, a machine named “DownstairsLap” will win over a machine named “UpstairsPC” if all other criteria tie, because ‘D’ is alphabetically before ‘U.’

Host files. :slight_smile: