When you enter a website URL into your browser’s address bar, the request is sent to a type of internet server known as a domain name server . This server takes the URL you entered and then checks which IP addresses are listed for the real servers hosting the content you are looking for.
The problem is, if there is something wrong with the nameserver, you won’t be able to access the site you want. Even worse, if the name server has been hacked, you may end up on a fake site! The good news is that you can manually specify the relationship between specific IP addresses and website addresses by simply adding a local DNS lookup to your hosts file.
What is a hosts file?
The hosts file is easy to understand. It’s just a text file. By the way, this is why you should just edit the file with something like Notepad, which won’t try to change the format or add additional formatting to the file.
Inside the hosts file, you can add a list of IP addresses along with the web address that the IP address should point to. You can combine any IP address and web address, even if they don’t actually match. You can have the actual IP address of Bing.com point to Google.com if you like.
Windows always checks the hosts file first before sending a request to the name server. Therefore, if the address that you enter in the browser is listed in the hosts file, you will be redirected to the IP address specified in the file.
What is local DNS lookup?
The process described in the previous paragraph is a local DNS lookup. Your computer looks up the IP address from your local drive on its own, without having to contact an external server. It is so simple!
– /
Why add local DNS lookup to the hosts file?
There are several reasons why you might want to add a local DNS lookup to your hosts file. We already mentioned several reasons at the beginning of the article, but people have found many creative ways to use this simple feature.
One of the important reasons for adding entries to the hosts file is speed. It will always be faster to do local searches than to go to an external server. Especially if this server is unreliable. Placing the most important or most frequently used sites in the hosts file means you no longer have to worry about the DNS service causing access problems.
You can also use the hosts file to block sites that you don’t want this computer to have access to. All you have to do is specify an IP address in the hosts file for that site, which either leads nowhere or points to a secure IP address. Common redirects include 0.0.0.0 and 127.0.0.1. This is the so-called “loopback” address.
If you have local devices like routers, IP cameras, network storage, etc., you can use the hosts file to give their IP addresses easy-to-remember names.
Using Hosts Premade Files
If adding dozens or even hundreds of sites to the hosts file seems quite tedious, then you are not alone! The good news is that there are tons of places on the internet where you can find ready-made lists that you can simply copy and paste into your own hosts file.
The main problem is that malicious redirects can be hidden in these lists. This means that you either need to check each IP address manually or make sure you trust the source of the list.
Editing hosts file in Windows 10
Since the hosts file leaves room for trouble, you can’t just open it and edit it. You will need administrator rights on your computer to make changes. Before making any changes to the hosts file, we strongly recommend that you copy and paste its original content into another text file in case something goes wrong!
To change the hosts file in Windows 10, follow these steps:
- Open the Start menu and type Notepad.
- When Notepad appears, right-click it and choose Run as Administrator.
- n Notepad, click Open, navigate to c: Windows System32 Drivers etc hosts and open the hosts file there. Remember to change the file type to All Files.
- You should see this default hosts file from Microsoft.
- Don’t worry about text already in the document. You can just leave it as it is and add your entries to the end of the file. Any line beginning with the “#” character is treated as a comment and is not used for name lookups.
It’s easy to add a local search to a list. Just write down the site’s IP address, space and then the site’s address.
Remember to save what you added when you close the file. That’s all you need to do! Now your computer will skip the entire DNS lookup process when accessing the sites you specify.
How to find a website’s IP address
What if you don’t know the IP address of the site you want to add to the hosts file? It’s actually pretty easy to find the IP address of a site using the command line in Windows 10 Here’s how to do it:
- Open the start menu and type “cmd”.
- After opening a command prompt, enter “tracert” followed by a space and the site to test. In this example, this is google.com. Then press the Enter key on your keyboard.
- Here you will see the site’s IP address. Now you can use this address in the hosts file.
The most hosts
Who would have thought that such a small text file hidden deep in the Windows folder could be so useful? You are now a true local search guru, controlling how your computer accesses websites.
–