ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Reset Your Hosts File

Updated on October 30, 2010

What Is A Hosts File?

A Hosts file allows you to customize the IP addresses that host names resolve to. For example, the actual IP address for www.yahoo.com as I write this is 66.94.230.37. The IP address for www.google.com is 216.239.63.104. By adding the following entry to my hosts file, I can redirect (on my pc only) www.yahoo.com to www.google.com:

216.239.63.104 www.yahoo.com

This works because Windows checks the Hosts file before it queries any DNS servers, and gives priority to the entries in the Hosts file. This can be particularly useful when you want to block certain domains altogether. To block access to www.some-bad-domain.com by looping the call back to your own computer, you would enter the following line into the Hosts file:

127.0.0.1 www.some-bad-domain.com

For a huge list of domains that you may wish to block, visit: MPVS.ORG

Reset Your Hosts File

Your Hosts file may have been hijacked, blocking your computer from accessing important updates for:

  • Microsoft Windows
  • Antivirus Programs
  • Spyware and Adware Programs

You may have to reset your Hosts file to regain control of your internet connection.

Other sites may have also been blocked or redirected. For example, if your browser is set to search from the address bar using the MSN search engine, calls to that search engine may have been redirected to a third party hijacker, giving you unwanted and biased search results instead of the results you expected from MSN.

The Hosts file can be difficult to track down on your computer, because the location of the Hosts file may vary, or it may not be present at all. There may also be other copies of the Hosts file in different locations on a single system.

To find every occurrence of the Hosts file on your system, Search your computer for files named "Hosts". Please note that while the Hosts file is a simple text file, it does NOT have a file extention. The file name is simply "Hosts", not "Hosts.txt" or anything similar.

Common Host File Locations

Common Hosts file locations include:

Windows XP   C:\Windows\system32\drivers\etc\
C:\Windows\Windows 2000   C:\WINNT\system32\drivers\etc\
C:\WINNT\Windows 98   C:\Windows\

Turn Your Hosts File On or Off

HostsOff & HostsON Batch Files

As a quick test and fix for many PCs, I have created a couple of batch files that will simply turn the most common Hosts files OFF or ON by renaming the files. This is not a perfect solution for many reasons, including:

  • Some programs may recreate an original, corrupt Hosts file if it is renamed, recreating the problem you are trying to overcome.
  • There may be entries in your Hosts file that legitimate programs require to work normally.
  • These batch files will not work for you if your hosts file is not located in one of the above locations.

Run the following batch file to rename Hosts files in the above locations to HostsOFF:

HostsOFF Batch File: Save text below as file name HostsOFF.BAT -- Run as Administrator

IF EXIST C:\Windows\system32\drivers\etc\hosts Attrib -r -s -h -a C:\Windows\system32\drivers\etc\hosts
IF EXIST C:\Windows\hosts Attrib -r -s -h -a C:\Windows\hosts
IF EXIST C:\WINNT\system32\drivers\etc\hosts Attrib -r -s -h -a C:\WINNT\system32\drivers\etc\hosts
IF EXIST C:\WINNT\hosts Attrib -r -s -h -a C:\WINNT\hosts

IF EXIST C:\Windows\system32\drivers\etc\hosts REN C:\Windows\system32\drivers\etc\hosts hostsOFF
IF EXIST C:\Windows\hosts REN C:\Windows\hosts hostsOFF
IF EXIST C:\WINNT\system32\drivers\etc\hosts REN C:\WINNT\system32\drivers\etc\hosts hostsOFF
IF EXIST C:\WINNT\hosts REN C:\WINNT\hosts hostsOFF

Run the following batch file to rename HostsOFF files in the above locations back to Hosts.

HostsON Batch File: Save text below as file name HostsON.BAT -- Run as Administrator

IF EXIST C:\Windows\system32\drivers\etc\hosts Attrib -r -s -h -a C:\Windows\system32\drivers\etc\hostsOFF
IF EXIST C:\Windows\hosts Attrib -r -s -h -a C:\Windows\hostsOFF
IF EXIST C:\WINNT\system32\drivers\etc\hosts Attrib -r -s -h -a C:\WINNT\system32\drivers\etc\hostsOFF
IF EXIST C:\WINNT\hosts Attrib -r -s -h -a C:\WINNT\hostsOFF

IF EXIST C:\Windows\system32\drivers\etc\hostsOFF REN C:\Windows\system32\drivers\etc\hostsOFF hosts
IF EXIST C:\Windows\hostsOFF REN C:\Windows\hostsOFF hosts
IF EXIST C:\WINNT\system32\drivers\etc\hostsOFF REN C:\WINNT\system32\drivers\etc\hostsOFF hosts
IF EXIST C:\WINNT\hostsOFF REN C:\WINNT\hostOFF hosts

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    working

    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, hubpages.com uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at: https://hubpages.com/privacy-policy#gdpr

    Show Details
    Necessary
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the googleapis.com or gstatic.com domains, for performance and efficiency reasons. (Privacy Policy)
    Features
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Marketing
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Statistics
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)