Windows Host File – SMB Network Share using host entry that points to local machine

file-sharingnetwork-shareserver-message-blockwindows-server-2008windows-server-2008-r2

I am doing something a little creative with our server. We are building a preloaded image of our server software. Sometimes our customers ask that we can store the data over a network share, and other customers do not. I was thinking we could get creative, and keep the post install simple.

My idea was, use the windows host file to point at 127.0.0.1 and have a local network share where all the data is stored. In the even that the customer wants us to store on their file server, we just update the host file to the remote server address.

Note — we have many services so we are trying to do it with as little "reconfiguration" as needed. a host file is at the root of the name resolution so that helps. We could do this manually and not do it this way. We are just wanting to be creative on this.

Server 2008 R2
File Server Role added

Local ServerName: SERVERA  (10.0.0.10)
Remote ServerName:  SERVERB  (10.0.0.11)
Host entry name GENERICSERVER     
Folder Shared on local or remote server:   SomeFileShare

Test1:
Host file on SERVERA:    10.0.0.11  GENERICSERVER 
\\GENERICSERVER\SomeFileShare -- Passed

Test2:
Host file on SERVERA:    10.0.0.10  GENERICSERVER 
\\GENERICSERVER\SomeFileShare -- **Failed**
\\SERVERA\SomeFileShare -- Pass
\\127.0.0.1\SomeFileShare -- Pass

Test3: 
Host file on SERVERA:    127.0.0.1  GENERICSERVER 
\\GENERICSERVER\SomeFileShare -- **Failed**
\\127.0.0.1\SomeFileShare -- Pass

Anyone have any idea why setting it up to access a remote server it works fine, but if I point it to the local machine (127.0.0.1 or the adapter address), it does not? It prompts me for a user/pass and even shows the system name of the server, but doesn't authenticate.

Any help is appreciated.

Best Answer

This is likely caused by a security feature in Windows that (by default) prevents localhost access to names that are not the hostname (CNAME's, or in your case host file custom names). Your results are consistent with what I've experienced.

You need to edit the registry and either add the genericserver name or disable the loopback protection. Here's some info I've collected about it, focused on IIS but also affects SMB.

http://www.fishbrains.com/2009/07/31/sharepoint-sites-unavail-from-local-host/

Related Topic