localhost resolved via DNS query on Windows7

There's no RFC that dictates localhost MUST be resolved locally. In this sense it's a hostname, just like all others.

Also note that you SHOULD add localhost to your DNS zones and resolve it correctly.
 
I was also looking for an RFC but I couldn't locate one. I agree that we shouldn't rely on hosts for resolution, still though I think that it is always good to have. Especially for localhost that should always resolve to 127.0.0.1 .

Regards
 
gkontos said:
Especially for localhost that should always resolve to 127.0.0.1.
Not really. If you have an IPv6-only host this is going to cause problems.
Which is also the reason why Microsoft removed localhost from the hosts file.
 
SirDice said:
Not really. If you have an IPv6-only host this is going to cause problems.
Which is also the reason why Microsoft removed localhost from the hosts file.

So you think that having no hosts file is better than using this ?

Code:
127.0.0.1	localhost
::1             localhost

Suppose that I need to bind an application to localhost only for security reasons. Is there any valid reason why I should use a DNS server instead of hosts ?

Regards
 
SirDice said:
There's no RFC that dictates localhost MUST be resolved locally. In this sense it's a hostname, just like all others.

Also note that you SHOULD add localhost to your DNS zones and resolve it correctly.

Chapter 4.1 of RFC 1912 supports your second statement, and given that, your first statement makes very much sense.
 
gkontos said:
So you think that having no hosts file is better than using this ?

Code:
127.0.0.1	localhost
::1             localhost
Which, again, will cause problems with an IPv6-only host.

Suppose that I need to bind an application to localhost only for security reasons. Is there any valid reason why I should use a DNS server instead of hosts ?
I'm not saying there's never a reason to use a hosts file, I'm saying I understand the reasoning not to supply one by default.
 
Back
Top