The Windows hosts file is a system file used to map IP addresses to domain names. This file, present in every operating system, allows a user to resolve the IP address of a site or local server without relying on DNS servers ( for all the details!
What the hosts file is
The hosts file is a simple text file located in the C:\Windows\System32\drivers\etc folder. In it, you can manually specify a list of IP addresses and their corresponding domain names, thus overriding the system DNS settings. The structure of this file is very simple and is based on lines of text that specify the IP address and domain separated by spaces or tabs.
Example of a line in the hosts file:
127.0.0.1 localhost
192.168.1.100 test.local
In this example:
127.0.0.1 localhostrepresents the loopback address, used to indicate the local machine
192.168.1.100 test.localindicates that the domaintest.localshould be resolved to the IP address192.168.1.100
Why use the hosts file?
The hosts file is useful for several reasons, including:
Testing websites in development: It is useful for developers and testers to temporarily associate a domain name with a test server
Blocking unwanted sites: Assigning the IP address 127.0.0.1 to a site (such as an unwanted advertising domain) will block the site
Fast name resolution: In network environments, it can be useful to quickly resolve domain names without depending on a DNS server
Temporary DNS override: To temporarily bypass the company or ISP DNS
How to edit the hosts file in Windows
Editing the hosts file requires Administrator privileges. Here are the steps to edit it:
1-Open Notepad as Administrator
- Click the Windows Start button
- Type "Notepad" or "Notepad" in the search bar
- Click "Run as Administrator"
Medium:
facebook:
X:
youtube:
SOCIAL SHARE CARD GENERATOR