Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

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/

share|improve this answer

Relying on the hosts file is generally a very poor idea as it leads to all sorts of problems later on when the network changes. I'd suggest using DNS instead. Create a standard host name for your application to use (something so cryptic that it's pretty certain never to clash with a "real" host) and ask clients that wish to use a network share to add a CNAME to point to the intended host. Have your application perform a DNS lookup at startup, testing for the existence of your target host, and use that information if it's valid or fall back to localhost if it's not.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.