Editing hosts file in windows
Host file in windows is used to map ip address into the its name. By using hosts file we can refers any particular IP address by using the name we specified.
the hosts file contains lines of ip address and its name for example
so every time we use ‘localhost’ in any networking activities in our laptop, this will be translated into 127.0.0.1, which is our loopback ip address, ip address belongs to our own laptop/pc/device.
How to edit hosts file
editing host file in windows is as simple as adding new lines containing ip address, space, and name we want to refer.
for example i want to add ip address 126.96.36.199 which i want it be referred by college.
just add it below the existing line
the steps :
1. the hosts file is located in C:/Windows/System32/Drivers/etc/
it is file with no extension
2. To open this file, you will need administrator privilege, so you need to open it using any word processor that has administrator privilege confirmed.
for example we can use notepad, but when we want to run notepad,
first, do the right click on notepad icon, then choose ‘run as administrator’, choose yes when dialogue appear
3. in menubar choose File > Open, look for C:\Windows\System32\drivers\etc
if you don’t see any file, make sure you choose *All File in file type option
4. You will find the hosts file, choose it, and open. Add the ip address and name you want and save those notepad using Ctrl+S.
Blocking web address using host file
Other simple use of Hosts file in windows and other operating system is to block web address. This can be done by pointing any web address which is inn their domain name, to our local ip address. for example, we want to block google.com and facebook.com. Then just add in our hosts file
it will point google.com to 127.0.0.1, our own ip address. so it will not reach the real google.com and display nothing in the web browser