What’s a Hosts File?When you access a website, your computer contacts your domain name system (DNS) server and requests its numerical IP address. For example, Facebook.com maps to 188.8.131.52. Your computer will then connect to this numerical IP address and access the website.
Why the Restriction is in PlaceUnfortunately, malware often edits the hosts file to add such lines. For example, the malware could point Facebook.com at a different IP address entirely – one run by a malicious organization. The malicious website could even be disguised as Facebook.com. A user would look at their address bar, see Facebook.com, and never consider that they may be looking at a phishing site.
Ways to Bypass the RestrictionBecause this restriction is put in place by the Windows Defender (formerly known as Microsoft Security Essentials) antivirus included with Windows 8, you have several options for bypassing it:
- Exclude the hosts file from being monitored in Windows Defender – If you want to use Windows Defender instead of a third-party antivirus, this is your best option. This does mean that Windows won’t protect you from malicious hosts file entries added by malware, however.
- Install a Third-Party Antivirus – Many third-party antivirus applications won’t be as aggressive about policing your hosts file. Many, such as avast! and AVG, are free. When you install a third-party antivirus, Windows Defender will disable itself.
Excluding the Hosts File
- To exclude the hosts file from being monitored in Windows Defender, first open Windows Defender – press the Windows key, type Windows Defender, and press Enter.
- Click the Settings tab and select the Excluded files and locations category.
- Click the Browse button and navigate to the following file:
C:\Windows\System32\Drivers\etc\hosts(If you installed Windows to a different directory, start in that directory instead of C:\Windows)
- Click the Add button and then click Save Changes to save your changes.
- You may now edit the hosts file normally.
Editing Your Hosts File
- You’ll have to edit your hosts file as administrator. If you open it normally and try to save it, you’ll see a message stating you don’t have permission to save a file in its location.
- To launch Notepad as administrator, press the Windows key, type Notepad, right-click the Notepad application that appears, and select Run as administrator. (You can also launch any other text editor you prefer, such as Notepad++.)
- Click File –> Open in the Notepad window and navigate to the following file:
- You’ll have to select All Files in the file type box at the bottom of the open dialog or the hosts file won’t appear in the list.
- 127.0.0.1 facebook.com
- 127.0.0.1 example.com