windows - Resolving UNC path using hosts file

07
2014-07
  • Questioner

    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?

  • Answers
  • Steve Lamb

    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

  • Klaus Byskov Pedersen

    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.

  • tzot

    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.


  • Related Question

    network shares - How-To define an Alias-Name for a given Fileserver?
  • Ice

    I'm building a testsystem and want to use the servernames like in the productive environment. For tcp-traffic i made an entry in the hosts-file but that seems not to work for fileservers (smb).

    How may i define an Alias-Name like (\Filer) for my fileserver with IP:192.168.1.2 and Name \testshare in our test-domain?


  • Related Answers
  • MDMarra

    You need to disable strict name checking on the server. If you have a DNS server on your test domain, you can add a CNAME instead of editing the host files.