Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm having a problem accessing a UNC path in Windows Server 2008 using the hosts file.

My hosts file looks like:

10.x.x.x     server_1

When trying to access the unc path:

This works:

\\10.x.x.x\data

This doesn't work and says "Windows cannot find \\server_1\data")

\\server_1\data

Does anyone know how to make it resolve the path using a hosts file?

share|improve this question

migrated from stackoverflow.com Jun 22 '11 at 7:37

This question came from our site for professional and enthusiast programmers.

1  
Correct me if I'm wrong, but "server_1" in your \\server_1 example isn't actually a domain name, so it wouldn't go "trough" your hosts file, would it? –  Nanne Jun 22 '11 at 6:44

3 Answers 3

Try adding

10.x.x.x     server_1

to %SYSTEM32%\drivers\etc\LMHOSTS

(Note this file doesn't exist by default)

LMHOSTS is to unc paths as HOSTS is to TPC/IP paths.

More info here http://technet.microsoft.com/en-us/library/cc959846.aspx

share|improve this answer

I found this article that explains what you can do to make aliases for localhost's UNC path. I was having a similar problem to the one you are having and did as the article explained, with a succesful result.

share|improve this answer
    
I had the exact same issue, and this worked perfectly for me. Thanks for the link. –  Joe Enos Jun 2 '12 at 17:34

Using a hosts file for resolving the hostname?
You might try removing the underscore: change server_1 to server1 or server-1. It used to be that underscores are invalid characters in system and domain names. Perhaps that's changed (although I've yet to see some underscore in the domain part of a website), but give it a try in any case.

share|improve this answer
    
Hi, I tried removing the underscore but its still not working. I am pretty sure it is not a name problem because I can call webservices with that name. For example: http://server_1/mywebservice/service.asmx works fine. But when using UNC file paths, it doesn't seem to be using the hosts file to resolve the name=/ –  FruitDealer Jun 22 '11 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.