What does the windows host file do




















Hi, I am the Technical support leader at Kentico. I'm here to help you use Kentico and get as much as possible out of it. What is the Hosts file and how to use it?

Juraj Ondrus — May 17, You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience. Necessary Necessary. Necessary cookies are absolutely essential for the website to function properly.

These cookies ensure basic functionalities and security features of the website, anonymously. The cookie is used to store the user consent for the cookies in the category "Analytics". The cookies is used to store the user consent for the cookies in the category "Necessary". The cookie is used to store the user consent for the cookies in the category "Other. The cookie is used to store the user consent for the cookies in the category "Performance". It does not store any personal data.

Functional Functional. Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features. Performance Performance. Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics Analytics. Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc. Advertisement Advertisement. The Hosts file tells your computer what the name is in numbers so the computer can go find it.

If the IP address is found in your Hosts file, the computer will stop looking and go to that site, but if it is not it will ask a DNS computer domain name server for the information.

Since the search ends once a match is found, that provides us with a mechanism to block sites we have no interest in.

We can put names and addresses into the Hosts file so your computer does not have to ask a DNS server to translate the domain name into an IP number. This speeds up access to the host site you want to see because your computer no longer has to query other systems on the Internet for the address translation.

When you type in a web address like www. If you put Yahoo! Computers have a host address of their own - it is known as the "localhost" address, with an IP address of If you associate another computer's host name with your localhost IP address, you have effectively blocked that host since all attempts to access it will lead back to you. That is how we will block sites using the Hosts file. We will tell our computer that the IP address of the site we want to block is our own address.

Back in the early days of the internet, before it was widespread, computers used a hosts file to map long, hard to remember IP addresses with much shorter, easier to remember hostnames. That way, instead of having to remember a long IP address, all you had to do was visit localhost. As the internet grew, so did the length and complexity of the hosts files. Also, each hosts file only worked for the computer it was on, and keeping them in sync with the changes in hostnames and IP addresses became a huge pain.

For example, imagine that you have two computers, A and B. Their hosts files contain this mapping for google. So everyone on computer B is stuck without Google until someone updates the hosts file. When that person does update the hosts file, they add another entry to handle Google with the www subdomain. Now everyone on computer B is taken to the correct website whether they visit google. And everyone on computer A can only visit google.

If you're thinking that someone should have just made a central repository to map all IP addresses with all hostnames, that's exactly what happened. Early on, a central hosts file was manually maintained and shared by the Stanford Research Institute. This system lead to the invention of domains and top level domains like. In the end, the humble hosts file and innovators like Elizabeth J.

Feinler lead to the invention of the Domain Name System still in use today. First, open Notepad as an administrator by pressing the Windows key, typing in "notepad", and clicking "Run as administrator":. You won't be able to see any files in this directory because they aren't text documents.

To change the file type, click on the dropdown in the bottom right of the Open menu and click on "All Files":. Note that everything is commented out with characters, meaning that nothing is actually being read from the hosts file.

Modern versions of Windows include a sort of DNS system already, so if you visit localhost it'll automatically redirect you to If you're doing some local development and are having problems with localhost, you can just remove the comments from your hosts file:. Then, open PowerShell by pressing the Windows key, searching for "powershell", and clicking "Run as Administrator":.



0コメント

  • 1000 / 1000