I was wondering , where does windows declares that localhost is - the machine itself (where is it configured?) ?

It is not in the hosts file.

I thought it is in the Registry but I couldn't find it there by searching.

As you can see , it does ping :

enter image description here

And hosts doesnt contain this definition

enter image description here

  • It's the hosts file.... – Ramhound Nov 29 '14 at 23:50
  • 2
    The actual definition used is defined within the DNS service itself. It does not depend on an external definition. – Crippledsmurf Nov 30 '14 at 0:02
  • @Crippledsmurf 1. The NSLookup doesn't return any results for Localhost, hence this doesn't come from the DNS serer. 2. If you disable the DNSCache service (which disables both the hosts file and the DNS cache), you can still ping Localhost and receive the same results. That doesn't add up. – EliadTech Nov 30 '14 at 6:01
  • @EliadTech so where from comes this setting ? – Royi Namir Nov 30 '14 at 6:02
  • 1
    Not the DNS server, the DNS service. This is a Windows system component which handles resolution of names. The name "localhost" is mapped directly to somewhere within this component, as alluded to by the remarks in the hosts file itself – Crippledsmurf Nov 30 '14 at 6:53

The Windows DNS service is the system component responsible for resolving DNS names. The name localhost is mapped to the IPv4 address and the IPv6 address ::1 within the DNS service, as part of it's code, rather than via any external source.

This is explicitly stated in the Windows hosts file:

localhost name resolution is handled within DNS itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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