A name collision occurs when an attempt to resolve a name used in a private namespace, such as Top-Level Domain or unqualified name results in a query to the public Domain Name System (DNS). When the administrative boundaries of private and public namespaces overlap, name resolution may yield unintended or harmful results.



This can be caused because of the hostname mostly, but there can be other reasons which can arise in this issue, some of those are listed below.

  • Incorrect Syntax or Names: Some basic problems can be like the name of hosts file should be hosts and not host without any extensions with it. A single incorrect syntax can mess up your entire program.
  • White spaces: If the code is copied from somewhere, then there is a possibility that your code will end up with multiple spaces.
  • Permissions and Proxies: Sometimes there can be issues with the permission on the file or file attributes. If there is a proxy configured on the system, then It may bypass the hosts file. Using no proxy is a better option to get less issue.

Now that you have a basic understanding of the nature of the problem, we will move on towards the methods.

Method 1: Making Sure Your hosts File is Correct

Before you check problem elsewhere, make sure that the hosts file is working correctly. The basic correction about the hosts file will be:

  • The file name should be “hosts” and not host
    You can locate hosts file here:


    Directory of hosts file
  • There should be no extension for the hosts file
    Note: Make sure you check the extension, because windows have an option of hiding extensions in view tab
    You can find the view tab in file explorer’s menu bar

    Enabling extensions in view tab of file explorer
  • The syntax should be correct in the hosts file
  • Make sure you take care of all variants ( and, sometimes one works but others won’t. Just add both to be safe.

    Adding both types of variants

You can check if the host file is working or not by typing the following commands in CMD (Admin Mode)

  1. Go to where CMD is, start menu or search in the search bar
    Note: For older windows, it will be: Start > All Programs > Accessories
  2. Right-click on CMD, select “Run as Administrator

    Opening cmd as administrator
  3. Type this command in cmd and enter:
    ipconfig /flushdns
    flushdns in cmd

    This will drop the old data records that may have been used.

  4. Now type the entry address that you added in your hosts file, to check if it uses the correct IP
    ping –n 1
    ping -6 –n 1

    checking if host file works or not
  5. If the IP is correct, it means your hosts file is working fine and the problem is elsewhere
  6. But if the IP test fails, then you can reset the NetBios cache with typing this command in cmd (admin mode):
    nbtstat –r
  7. And you can check the current data in the DNS cache with the following command in cmd (normal mode):
    ipconfig /displaydns | more

    Reset cache and check data in dns

Method 2: Checking for Whitespace

A single space even at the blank entry between two lines can mess things up. Notepad++ can help in showing the characters and inspecting the number of whitespace characters. If you copied the host entries from somewhere else, then there is the possibility of multiple spaces in it. To make sure the spaces don’t mess things up, just use spaces or tabs, not both and terminate the file with a blank line.

Method 3: Checking and Editing the Registry

You can find the key in registry editor which is specifying the location of the hosts file. You can check the entry in the key. If it wasn’t the correct one, then you can edit it. Also, for those who are missing the key in their registry or several other entries; they can create it or just copy it from other machines, that already have these.

  1. Open “Run” by pressing Windows + R keys
  2. Type regedit in it and enter

    opening regedit through run
  3. Now go to the following directory in Registry Editor:

    DataBasePath key in the registry editor
  4. DataBasePath is the key that you will be checking, the entry in it should be:

Method 4: Creating New hosts File with Default Permissions

The permission for the already available hosts file can have some issues. You can create the new one and copy the content of the existing one to the new one. The old hosts file will have the grey check marks, while the new will have black check marks. What this will do is, that the system will recreate the file with default permissions. To do so, follow the steps below:

  1. Create a new text file on Desktop
  2. Now open your “Notepad” as an administrator

    Opening notepad as administrator
  3. Click File and then Open
  4. Then, go to the following address:
  5. Locate the “hosts” file and open it, select all the text and copy it

    opening the existing host file in system32
  6. And paste it into the text file that you created on the Desktop
  7. Rename it to “hosts” without any extensions
  8. Now this is a bit tricky step, you need to copy (do not move) the new hosts file to the existing one and overwrite it
    Note: For some users, copying worked and for some moving worked. First, try copying one.

If you are unable to read the existing old hosts file. You can do the following steps:

  1. Go to the following directory:
  2. Right-click “hosts” file and select “Properties
  3. Now go into the “Security” tab
  4. In “Group or usernames” box, find the

    hosts file properties
  5. Check the permissions in below box and see if the user is allowed or not
  6. If the user is not allowed you can click “Edit” and there tick the following box for a user to allow:
    Read & Execute

    giving permission to the user to open the hosts file
  7. Then you will be able to edit the hosts file in notepad by opening it as administrator.

Method 5: Checking Proxy Issues

This method is about; if any proxy is configured on the system which might be bypassing the hosts file. In this method, we will check, if the system is running any proxy. We can check it on Internet Explorer by following steps:

  1. Hold the Windows Key and Press R. Type inetcpl.cpl and Click OK.
  2. Select the Connections tab and click on LAN settings
  3. Make sure the “Automatically detect settings” is checked, and the Proxy server is unticked. After checking the proxy settings, check if the issue is resolved.

    Checking the proxy in Internet Explorer options

Kevin Arrows

Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.
Back to top button