How do you Add a Local DNS Lookup to Hosts File in Windows 10



Updated December 2024: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
  1. Download and install the repair tool here.
  2. Let it scan your computer.
  3. The tool will then repair your computer.

The DNS (Domain Name System or Service) is a hierarchical, decentralized name system/service that translates domain names into IP addresses on the Internet or a private network, and a server that provides such a service is called a DNS server.

For example, you can test a website locally with a custom domain name before making it public by modifying the /etc/hosts file on your local system so that the domain name points to the IP address of the local DNS server you have configured.

The /etc/hosts file is an operating system file that translates host or domain names into IP addresses. This is useful for testing changes to websites or SSL configuration before a website becomes public.

What is the /etc/hosts file?

It is a simple text file. The operating system uses this file to match the host name to the IP address. When we try to access a host using the host/domain name, the operating system first checks whether or not there is an entry for it in the hosts file. If it finds an association, it uses the associated IP address to communicate with the host machine. Here is an example of how we define entries in this folder:

December 2024 Update:

You can now prevent PC problems by using this tool, such as protecting you against file loss and malware. Additionally, it is a great way to optimize your computer for maximum performance. The program fixes common errors that might occur on Windows systems with ease - no need for hours of troubleshooting when you have the perfect solution at your fingertips:

  • Step 1 : Download PC Repair & Optimizer Tool (Windows 10, 8, 7, XP, Vista – Microsoft Gold Certified).
  • Step 2 : Click “Start Scan” to find Windows registry issues that could be causing PC problems.
  • Step 3 : Click “Repair All” to fix all issues.

Download Now

  • Location of hosts file on Windows: %SystemRoot%\System32\driver\etc\host
  • Location of the Hosts file under Linux: /etc/hosts
  • Let’s see how we can use the Hosts file in a load balancing scenario to access the website from a specific server.

Editing the Hosts File in Windows 10

Because the host file leaves some leeway, you can’t just open and modify it. You must have administrator rights on your computer to make changes. Before making changes to your host file, we strongly recommend that you copy and paste its original contents into another text file, in case something goes wrong!

To edit your hosts file in Windows 10, follow these steps:

  • Open the Start menu and type “Notepad”.
  • Once Notepad appears, right-click it and select “Run as Administrator”.
  • Click “Open” and go to c:\Windows\System32\driver\etc\hosts and open the hosts file. Don’t forget to change the file type to “All files”.
  • You should see this default Microsoft hosts file.
  • Don’t worry about the text that is already in the document. You can just leave it as it is and add your own entries at the end of the file. Any line that starts with a “#” symbol is treated as a comment and is not used for name searches.

Adding a local search list to the list is super easy. Just write down the IP address of the website, followed by a space, then the website address.

Don’t forget to save what you’ve added when you close the file. That’s all you have to do! Your computer will now skip the entire DNS lookup process when accessing the websites you specify.

https://www.siteground.com/kb/how_to_use_the_hosts_file/



Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here

Scroll to Top