Hosts File: What it is and how to use it.

Hosts File: What it is and how to use it.

Overview

Ah, the humble Hosts file, a cornerstone of internet navigation and a geek’s best friend for custom domain mapping and ad blocking. Today, we embark on a nostalgic journey through the digital nooks and crannies of operating systems, exploring where this plain text powerhouse resides across a spectrum of platforms. From Windows to iOS, and Unix to Android, if you’ve ever wondered how to bend the internet to your will (or at least, make it a bit more bearable), you’ve come to the right place.

According to Wikipedia, the computer file hosts is an operating system file that maps hostnames to IP addresses. It is a plain text file. Originally a file named HOSTS.TXT was manually maintained and made available via file sharing by Stanford Research Institute.

Basically, the Hosts serve to redirect local domains and block access to resources on the internet.

Locais

Operating SystemVersionsLocation
Unix, Unix-like, POSIX/etc/hosts
Microsoft Windows3.1%WinDir%\HOSTS
Microsoft Windows95, 98, ME%WinDir%\hosts
Microsoft WindowsNT, 2000, XP, 2003, Vista, 2008, 7, 2012, 8, 10%SystemRoot%\System32\drivers\etc\hosts
Windows Mobile, Windows PhoneRegistry: HKEY_LOCAL_MACHINE\Comm\Tcpip\Hosts
Apple Macintosh9 and earlierPreferences or System folder
Apple MacintoshMac OS X 10.0–10.1.5(Added through NetInfo or niload)
Apple MacintoshMac OS X 10.2 and newer/etc/hosts (a symbolic link to /private/etc/hosts)
Novell NetWareSYS:etc\hosts
OS/2 & eComStation“bootdrive”:\mptn\etc\
SymbianSymbian OS 6.1–9.0C:\system\data\hosts
SymbianSymbian OS 9.1+C:\private\10000882\hosts
MorphOSNetStackENVARC:sys/net/hosts
AmigaOS4DEVS:Internet/hosts
AROSENVARC:AROSTCP/db/hosts
Android/etc/hosts (a symbolic link to /system/etc/hosts)
iOSiOS 2.0 and newer/etc/hosts (a symbolic link to /private/etc/hosts)
TOPS-20HOSTS.TXT
Plan 9/lib/ndb/hosts
BeOS/boot/beos/etc/hosts
Haiku/boot/common/settings/network/hosts
OpenVMSUCXUCX$HOST
OpenVMSTCPwareTCPIP$HOST
3.7, 5!Boot.Resources.!Internet.files.Hosts
RISC OSlater boot sequence!Boot.Choices.Hardware.Disabled.Internet.Files.Hosts

Examples

  • Original Windows Hosts
# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost
  • Hosts file blocking Adobe and Techsmish (Warning: if you use this file, some softwares may not work properly afterwards).
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

#Adobe Blocker
127.0.0.1 na1r.services.adobe.com 
127.0.0.1 hlrcv.stage.adobe.com 
127.0.0.1 lmlicenses.wip4.adobe.com 
127.0.0.1 lm.licenses.adobe.com 
127.0.0.1 activate.adobe.com 
127.0.0.1 practivate.adobe.com 

#Techsmith blocker
127.0.0.1 activation.cloud.techsmith.com
127.0.0.1 oscount.techsmith.com
127.0.0.1 updater.techsmith.com
127.0.0.1 camtasiatudi.techsmith.com
127.0.0.1 tsccloud.cloudapp.net
127.0.0.1 assets.cloud.techsmith.com
  • Unnecessarily large Hosts File blocking Ad serving sites.
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost

#Adobe Blocker
127.0.0.1 na1r.services.adobe.com 
127.0.0.1 hlrcv.stage.adobe.com 
127.0.0.1 lmlicenses.wip4.adobe.com 
127.0.0.1 lm.licenses.adobe.com 
127.0.0.1 activate.adobe.com 
127.0.0.1 practivate.adobe.com 

#Techsmith blocker
127.0.0.1 activation.cloud.techsmith.com
127.0.0.1 oscount.techsmith.com
127.0.0.1 updater.techsmith.com
127.0.0.1 camtasiatudi.techsmith.com
127.0.0.1 tsccloud.cloudapp.net
127.0.0.1 assets.cloud.techsmith.com

# [Start of entries generated by MVPS HOSTS]
#
# [Misc A - Z]
0.0.0.0 fr.a2dfp.net
0.0.0.0 m.fr.a2dfp.net
0.0.0.0 mfr.a2dfp.net
0.0.0.0 ad.a8.net
0.0.0.0 asy.a8ww.net
0.0.0.0 static.a-ads.com
0.0.0.0 atlas.aamedia.ro
0.0.0.0 abcstats.com
0.0.0.0 ad4.abradio.cz
0.0.0.0 a.abv.bg
0.0.0.0 adserver.abv.bg
0.0.0.0 adv.abv.bg
0.0.0.0 bimg.abv.bg
0.0.0.0 ca.abv.bg
0.0.0.0 track.acclaimnetwork.com
0.0.0.0 accuserveadsystem.com
0.0.0.0 www.accuserveadsystem.com
0.0.0.0 achmedia.com
0.0.0.0 csh.actiondesk.com
0.0.0.0 ads.activepower.net
0.0.0.0 app.activetrail.com
0.0.0.0 stat.active24stats.nl #[Tracking.Cookie]
0.0.0.0 traffic.acwebconnecting.com
0.0.0.0 office.ad1.ru
0.0.0.0 cms.ad2click.nl
0.0.0.0 ad2games.com
0.0.0.0 ads.ad2games.com
0.0.0.0 content.ad20.net
0.0.0.0 core.ad20.net
0.0.0.0 banner.ad.nu
0.0.0.0 adadvisor.net
0.0.0.0 tag1.adaptiveads.com
0.0.0.0 www.adbanner.ro
0.0.0.0 wad.adbasket.net
0.0.0.0 ad.pop1.adbn.ru
0.0.0.0 ad.top1.adbn.ru
0.0.0.0 ad.rich1.adbn.ru
0.0.0.0 adbox.hu
0.0.0.0 james.adbutler.de #[Tracking.Cookie]
0.0.0.0 www.adbutler.de
0.0.0.0 tw1.adbutler.us
0.0.0.0 www.adchimp.com
0.0.0.0 static.adclick.lt
0.0.0.0 engine.adclick.lv
0.0.0.0 show.adclick.lv
0.0.0.0 static.adclick.lv
0.0.0.0 www.adclick.lv
0.0.0.0 ad-clix.com
0.0.0.0 www.ad-clix.com
0.0.0.0 servedby.adcombination.com
0.0.0.0 adcomplete.com
0.0.0.0 www.adcomplete.com
0.0.0.0 adcore.ru
0.0.0.0 pixel.adcrowd.com
0.0.0.0 ct1.addthis.com
0.0.0.0 static.uk.addynamo.com
0.0.0.0 www.adexit.com
0.0.0.0 s.adexpert.cz
0.0.0.0 static.adfclick1.com
0.0.0.0 222-33544_999.pub.adfirmative.com
0.0.0.0 c.adfirmative.com
0.0.0.0 www.adfirmative.com
0.0.0.0 adfocus.ru
0.0.0.0 adx.adform.net
0.0.0.0 dmp.adform.net
0.0.0.0 s1.adform.net
0.0.0.0 server.adform.net
0.0.0.0 track.adform.net
0.0.0.0 server.adformdsp.net
0.0.0.0 adforce.ru
0.0.0.0 adforati.com
0.0.0.0 ads.adfox.ru
0.0.0.0 gazeta.adfox.ru
0.0.0.0 p.adframesrc.com
0.0.0.0 s.adframesrc.com
0.0.0.0 media.adfrontiers.com
0.0.0.0 www.adgitize.com
0.0.0.0 code.ad-gbn.com
0.0.0.0 www.ad-groups.com #[Ban Man Pro Banner Code]
0.0.0.0 adhall.com
0.0.0.0 pool.adhese.be
0.0.0.0 adhitzads.com
0.0.0.0 ads.static.adhood.com
0.0.0.0 app.pubserver.adhood.com
0.0.0.0 app.winwords.adhood.com
0.0.0.0 ssl3.adhost.com
0.0.0.0 www2.adhost.com
0.0.0.0 adfarm1.adition.com
0.0.0.0 imagesrv.adition.com
0.0.0.0 ad.adition.net
0.0.0.0 hosting.adjug.com
0.0.0.0 tracking.adjug.com
0.0.0.0 aj.adjungle.com
0.0.0.0 rotator.hadj7.adjuggler.net
0.0.0.0 thewrap.rotator.hadj7.adjuggler.net
0.0.0.0 yorick.adjuggler.net
0.0.0.0 adsearch.adkontekst.pl
0.0.0.0 stat.adlabs.ru
0.0.0.0 d.tds.adlabs.ru
0.0.0.0 www.adlantis.jp
0.0.0.0 publicidad.adlead.com
0.0.0.0 www.adlimg03.com
0.0.0.0 regio.adlink.de
0.0.0.0 west.adlink.de
0.0.0.0 rc.de.adlink.net #[Tracking.Cookie]
0.0.0.0 tr.de.adlink.net
0.0.0.0 n.admagnet.net
0.0.0.0 ads3.adman.gr #[Tracking.Cookie]
0.0.0.0 gazzetta.adman.gr
0.0.0.0 r2d2.adman.gr
0.0.0.0 talos.adman.gr
0.0.0.0 adman.in.gr
0.0.0.0 admarket.cz
0.0.0.0 www.admarket.cz
0.0.0.0 bridge.ame.admarketplace.net #[Spamdexing]
0.0.0.0 bridge.sf.admarketplace.net
0.0.0.0 a1.admaster.net
0.0.0.0 img.admaster.net
0.0.0.0 admedien.com
0.0.0.0 www.admedien.com
0.0.0.0 apps.admission.net #[Spotlight Ads]
0.0.0.0 appcache.admission.net
0.0.0.0 dt.admission.net
0.0.0.0 view.admission.net
0.0.0.0 ad.admitad.com
0.0.0.0 cdn.admitad.com
0.0.0.0 www.ad.admitad.com
0.0.0.0 cdn.admixer.net
0.0.0.0 ads.admodus.com #[Tracking.Cookie]
0.0.0.0 run.admost.com
0.0.0.0 assets3.admulti.com
0.0.0.0 go.admulti.com
0.0.0.0 s.admulti.com
0.0.0.0 ads.adnet.am
0.0.0.0 ad.adnet.biz #[Tracking.Cookie]
0.0.0.0 adnet.com.ua
0.0.0.0 delivery.adnetwork.vn
0.0.0.0 img.adnet.com.tr
0.0.0.0 www.ad-net.co.uk
0.0.0.0 adnext.fr
0.0.0.0 cdn.adnotch.com
0.0.0.0 ad.adnow.com
0.0.0.0 tt11.adobe.com #[adobe.tcliveus.com]
0.0.0.0 ace.adoftheyear.com
0.0.0.0 ad01.adonspot.com
0.0.0.0 ad02.adonspot.com
0.0.0.0 adperium.com
0.0.0.0 adk2.adperium.com
0.0.0.0 www.adperium.com
0.0.0.0 img.adplan-ds.com
0.0.0.0 res.adplus.co.id
0.0.0.0 e.adpower.bg
0.0.0.0 ab.adpro.com.ua
0.0.0.0 adpublimo.com
0.0.0.0 pop.adrent.net
0.0.0.0 adroll.com
0.0.0.0 rtt.adrolays.de
0.0.0.0 n.ads1-adnow.com
0.0.0.0 n.ads2-adnow.com
0.0.0.0 n.ads3-adnow.com
0.0.0.0 vu.adschoom.com
0.0.0.0 core1.adservingfactory.com
0.0.0.0 content.adservingfactory.com
0.0.0.0 track.adservingfactory.com
0.0.0.0 p78878.adskape.ru
0.0.0.0 map2.adsniper.ru
0.0.0.0 f-nod2.adsniper.ru
0.0.0.0 content.adspynet.com
0.0.0.0 engine.adspynet.com
0.0.0.0 ads.adsready.com
0.0.0.0 ads.adsurve.com
0.0.0.0 www.adsurve.com
0.0.0.0 cntr.adrime.com
0.0.0.0 images.adrime.com #[Adsolutions]
0.0.0.0 ad.adriver.ru
0.0.0.0 content.adriver.ru
0.0.0.0 ssp.adriver.ru
0.0.0.0 r.adrolays.de
0.0.0.0 adrotate.se
0.0.0.0 www.adrotate.net
0.0.0.0 delivery.ads-creativesyndicator.com
0.0.0.0 adsafiliados.com.br
0.0.0.0 ad.adsafiliados.com.br
0.0.0.0 v2.adsbookie.com
0.0.0.0 rh.adscale.de
0.0.0.0 assets.adtaily.com
0.0.0.0 viewster-service.adtelligence.de
0.0.0.0 adtgs.com
0.0.0.0 fusion.adtoma.com
0.0.0.0 core.adunity.com
0.0.0.0 engage2.advanstar.com
0.0.0.0 ddnk.advertur.ru
0.0.0.0 ds.advg.jp
0.0.0.0 m.adx.bg
0.0.0.0 www.adshost2.com
0.0.0.0 js.adscale.de
0.0.0.0 ih.adscale.de
0.0.0.0 adscendmedia.com
0.0.0.0 adservicedomain.info
0.0.0.0 adserver-voice-online.co.uk
0.0.0.0 adsfac.net #[Facilitate Tracking Code]
0.0.0.0 adsgangsta.com
0.0.0.0 adsfac.eu
0.0.0.0 ad.ad-srv.net
0.0.0.0 www.adshot.de
0.0.0.0 f-nod1.adsniper.ru
0.0.0.0 sync2.adsniper.ru
0.0.0.0 cdn6.adspirit.de
0.0.0.0 www.adspace.be
0.0.0.0 adsplius.lt
0.0.0.0 ads.adsponse.de
0.0.0.0 openx.adtext.ro
0.0.0.0 ads.adtiger.de
0.0.0.0 www.adtiger.de
0.0.0.0 ad.adtoma.com
0.0.0.0 au-01.adtomafusion.com
0.0.0.0 bn-01.adtomafusion.com
0.0.0.0 adv.adtotal.pl #[server down?]
0.0.0.0 rek.adtotal.pl
0.0.0.0 www.adtrade.net
0.0.0.0 www.adtrader.com
0.0.0.0 adtradr.com
0.0.0.0 ads.adtube.de
0.0.0.0 www.adultcommercial.net
0.0.0.0 adultmoneymakers.com
0.0.0.0 tracking.adultsense.com
0.0.0.0 www.adult-tracker.de
0.0.0.0 ad.aduserver.com
0.0.0.0 adv758968.ru
0.0.0.0 advaction.ru
0.0.0.0 euroad1.advantage.as
0.0.0.0 mf.advantage.as
0.0.0.0 mfad1.advantage.as
0.0.0.0 adve.net
0.0.0.0 ad.adver.com.tw
0.0.0.0 apps.advertlets.com
0.0.0.0 www.advertlets.com
0.0.0.0 ads.advertise.net
0.0.0.0 www.advertsponsor.com
0.0.0.0 ad.adverticum.net
0.0.0.0 img.adverticum.net
0.0.0.0 imgs.adverticum.net
0.0.0.0 www.advertising365.com
0.0.0.0 titan.advertserve.com
0.0.0.0 ad.advertstream.com
0.0.0.0 usas1.advfn.com
0.0.0.0 images.adviews.de
0.0.0.0 www.adviews.de
0.0.0.0 ad.adview.pl
0.0.0.0 adp.adview.pl
0.0.0.0 bi.adview.pl
0.0.0.0 chart.advinion.com
0.0.0.0 advizi.ru
0.0.0.0 adv.adwish.net
0.0.0.0 ads.adwitserver.com
0.0.0.0 ad.adworx.at
0.0.0.0 www.ad-z.de
0.0.0.0 ads.afa.net
0.0.0.0 affbeat.com
0.0.0.0 affiliate.affdirect.com
0.0.0.0 sttc.affiliate.hu
0.0.0.0 tr.affiliate.hu
0.0.0.0 img.network.affiliando.com
0.0.0.0 view.network.affiliando.com
0.0.0.0 ads.affiliateclub.com
0.0.0.0 affiliategroove.com
0.0.0.0 banners.affiliatefuture.com
0.0.0.0 images.affiliator.com
0.0.0.0 imp.affiliator.com
0.0.0.0 rotation.affiliator.com
0.0.0.0 media.affiliatelounge.com
0.0.0.0 js.affiliatelounge.com
0.0.0.0 record.affiliatelounge.com
0.0.0.0 web1.affiliatelounge.com
0.0.0.0 banners.affilimatch.de
0.0.0.0 ad.afilo.pl
0.0.0.0 adserwer.afilo.pl
0.0.0.0 ads.afraccess.com
0.0.0.0 ads.aftonbladet.se
0.0.0.0 stats.agent.co.il
0.0.0.0 stats.agentinteractive.com
0.0.0.0 w.ahalogy.com
0.0.0.0 ac.ajur.info #[WebBug]
0.0.0.0 openx.ajur.info
0.0.0.0 adlik2.akavita.com
0.0.0.0 dmtracking2.alibaba.com
0.0.0.0 all2lnk.com
0.0.0.0 ads.allaccess.com.ph
0.0.0.0 adcontent2.allaccess.com.ph
0.0.0.0 adservice.aliexpress.com
0.0.0.0 ad.allstar.cz
0.0.0.0 taobaoafp.allyes.cn
0.0.0.0 bokee.allyes.com
0.0.0.0 demoafp.allyes.com
0.0.0.0 eastmoney.allyes.com
0.0.0.0 smarttrade.allyes.com
0.0.0.0 sroomafp.allyes.com
0.0.0.0 taobaoafp.allyes.com
0.0.0.0 tom.allyes.com
0.0.0.0 uuseeafp.allyes.com
0.0.0.0 yeskyafp.allyes.com
0.0.0.0 eas.almamedia.fi
0.0.0.0 ad.altervista.org
0.0.0.0 pqwaker.altervista.org
0.0.0.0 adimg.alice.it
0.0.0.0 adv.alice.it
0.0.0.0 advloc.alice.it
0.0.0.0 altmedia101.com
0.0.0.0 www.alwayson-network.com
0.0.0.0 adtools2.amakings.com
0.0.0.0 banner.amateri.cz
0.0.0.0 amazing-offers.co.il
0.0.0.0 ad.amgdgt.com
0.0.0.0 adserver.amna.gr
0.0.0.0 10394-127.ampxchange.com #[Spamdexing]
0.0.0.0 10394-4254.ampxchange.com
0.0.0.0 10394-2468.ampxchange.com
0.0.0.0 vfdeprod.amobee.com
0.0.0.0 widgets.amung.us
0.0.0.0 whos.amung.us #[WebBug]
0.0.0.0 analytics.analytics-egain.com
0.0.0.0 cloud-us.analytics-egain.com
0.0.0.0 gw.anametrix.net #[WebBug]
0.0.0.0 www.anastasiasaffiliate.com
0.0.0.0 advert.ananzi.co.za
0.0.0.0 advert2.ananzi.co.za
0.0.0.0 box.anchorfree.net
0.0.0.0 rpt.anchorfree.net
0.0.0.0 a.androidandme.com
0.0.0.0 analytics.androidandme.com #[Piwik.Analytics]
0.0.0.0 www.anticlown.com
0.0.0.0 antventure.com
0.0.0.0 webtracker.apicasystem.com
0.0.0.0 junior.apk.net
0.0.0.0 openx.apollo.lv
0.0.0.0 ads.asia1.com.sg
0.0.0.0 ads.ask.com #[sv-click.looksmart.com]
0.0.0.0 www.asknew.com #[Spamdexing]
0.0.0.0 stats.asp24.pl
0.0.0.0 ads.aspalliance.com
0.0.0.0 www.astalavista.us
0.0.0.0 atemda.com
0.0.0.0 logw349.ati-host.net
0.0.0.0 rules.atgsvcs.com
0.0.0.0 logw312.ati-host.net
0.0.0.0 p.ato.mx
0.0.0.0 s.ato.mx
0.0.0.0 ads.auctionads.com
0.0.0.0 banners.audioholics.com
0.0.0.0 ad.auditude.com
0.0.0.0 ads.auctioncity.co.nz
0.0.0.0 d.audienceiq.com
0.0.0.0 ads.autoscout24.com
0.0.0.0 ads.autotrader.com
0.0.0.0 adserving.autotrader.com
0.0.0.0 profiling.avandor.com
0.0.0.0 avantlink.com
0.0.0.0 www.avantlink.com
0.0.0.0 fhg.avrevenue.com #[server down?]
0.0.0.0 rev.avsforum.com
0.0.0.0 ads.avusa.co.za
0.0.0.0 engine.awaps.net
0.0.0.0 analytics.aweber.com
0.0.0.0 clicks.aweber.com #[affects newsletters]
0.0.0.0 tracker.azet.sk
0.0.0.0 www.azmsoft.com

Referência

Translations: