The hosts file, a legacy from the early days of the internet, is still a useful tool for mapping IP addresses to hostnames. This guide will walk you through different methods to edit this file in Windows 11.
On modern versions of Windows, including Windows 11, the hosts file is located at %SystemRoot%\System32\drivers\etc\hosts
.
The hosts file contains lines of text with two columns - an IP address and a corresponding computer hostname. The columns can be separated by a space or a tab. The hosts file can be used to override DNS servers or provide hostname lookup in the absence of a DNS server.
By default, the hosts file in Windows 11 doesn't contain any valid entries. All entries are commented out using the '#' symbol. To edit the hosts file:
%SystemRoot%\System32\drivers\etc\
in the 'Quick access' box and press ENTER.NOTE: Only administrators can edit the hosts file in Windows, as it's located in a protected system directory.
There are two ways to edit the hosts file. The first method involves making a copy of the original file, editing it, and then replacing it. The second method uses the command line to append a line to the hosts file.
echo
command to add a new entry to the hosts file. For example, echo 192.168.1.10 BOBPC >> %SystemRoot%\System32\drivers\etc\hosts
.Using either method, you'll be able to successfully edit the hosts file in Windows 11.