How To Use Etc Hosts File
In this example we will block facebook.
How to use etc hosts file. Once notepad is open you can edit the file. Configure dns locally using etc hosts file in linux. Host name is the name of the host. To access the hosts file in windows 7 you can use the following command in the run line to open notepad and the file. In the text editor select file open and open the host file location at c windows system32 drivers etc.
Now open the etc hosts file using your editor of choice as follows sudo vi etc hosts then add the lines below to the end of the file as shown in the screen shot below. Go to the real hosts file location and rename it. Once the files are visible select hosts file and click on the open button. In the file name field paste the following path in. Edit using the correct format and save the hosts file with windows notepad.
Follow the screenshot for better understanding. 1 on the windows 10 computer right click on the start menu and select command prompt admin. In open file dialogue box type c windows system32 drivers etc as the file name entry. Add the following line to the etc hosts file. Alternatively you can navigate to c windows system32 drivers etc using the left pane menu.
From a workstation that has access to your storage system edit the etc hosts file. Copy and paste the new hosts file to that location accepting the permissions popup. 2 after that in the command prompt window type the below commands one after another to go to the hosts file directory and open the hosts file in the notepad program. Now that you have edited your hosts file make sure to save it. Right click notepad and choose run as administrator.
Now notice if we try to access facebook in ie we can t get to the page. You can edit the hosts file using any text editor. To do this just enter in the following after the mark. Select text documents txt in the bottom right of the open window and change it to all files. Ip address host name aliases ip address is the ip address of the host.