How to Modify DNS Hosts File for Windows

This article will help you to understand the steps to modify the DNS host file for Windows. The operating system consists of Windows and employs the host’s file (also called etc/hosts) as a text file to map IP addresses to host names and domain names. This file changes the mappings from the DNS server to your system is connected across the network and serves as a local DNS service for your local machine.

Important Note: Editing the host file requires administrative privileges. Make sure you run Notepad as administrator before proceeding.

  1. Open Notepad as administrator:
    • Press the Start button and search for “Notepad”.
    • Right-click on “Notepad” and select “Run as administrator”.
    • Click “Yes” if prompted by the User Account Control (UAC).
  2. Open the host’s file:
    • In Notepad, click on “File” and then “Open”.
    • In the address bar at the top, paste the following path:
      C:\Windows\System32\drivers\etc\hosts
    • Click on “All Files” in the file type dropdown (it might be named “Text Documents” by default).
    • Select “hosts” from the list and click “Open”.
  3. Edit the hosts file:
    • The host file contains lines of text. A line that includes the “#” symbol may get ignored.
    • To map a domain name to a specific IP address, add a new line at the end of the file with the IP address followed by a space and then the domain name. For example:0.0.1 www.example.com
    • You can add multiple entries by adding new lines for each mapping.
  4. Save the changes:
    • Click on “File” and then “Save”.
  5. Flush the DNS cache (optional):
    • To make the changes take effect immediately, you can flush the DNS cache. Check the Command Prompt as administrator and write the following command: ipconfig /flushdns. Press Enter to execute the command.

Remember: Modifying the host file can affect how your computer resolves domain names. Make sure you understand the changes you are making and only edit the file if necessary.

Leave a Reply