Moderator

El Psy Congroo!

Rank: 7Rank: 7Rank: 7

Credits
25154
Device
Mi 5
MIUI Version
7.11.21
Online time
676 Hours
Send PM

Mi BoxMi KeyMi BandXiaomi 6 LaunchMi In-Ear HeadphonesMi  BunnyFantastic!Awesome!FlashholicMIUI 2015MIUI 7I Love MIUIMIUI 8MIUI 6MIUI Devices Contest4 Million Forum MembersMi 3Mi NoteMIUI Fan from Malaysia2014 ChristmasThanksgiving DayMIUI Fan From IndonesiaDiwali Fan MIUI PhilippinesMIUI Fan From Singapore1st Anniversary300K Forum MembersMIUI Fan From PhilippinesHappy Singles' DayMIUI 4th AnniversaryMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourMIUI 6th AnniversaryRooster Year of 20173500K Forum MembersSuper MondayMIUI 2017MIUI 91900K Forum Members1 Million Forum MembersMIUI 300 WeeksHappy Valentine's DayMIUI 100 Million UsersMerry ChristmasAlpaca Mi Bunny I Love Mi BunnyGamer Mi BunnyMIUI ReviewTechnology GuruMIUI FollowerMost Active MIUIerMIUI Android 4.4 KitKatForum Contest LoverMIUI Global Forum 2014Mi Lover MedalStar Of IconsDie-hard MIUI FanYouth PledgeHumor MasterScroll Of WisdomAndroid GuruInbox ZeroUpdates LoverMIUI FB Follower

[Tips & Tutorials] [MIUI Beta Team] What the TECH?!!! #2 - What does the HOSTS file do?

[ Promote]
7971 44 |
17:54, Nov-29-2014 | From PC
|
|
Go to reply no.
This post was edited by Iyengar at 05:37, Dec-01-2014

Unfamiliar with this Series? Check out the First Issue! first

Hi Guys! Presenting Issue #2

What the TECH template hosts.jpg

127.0.0.1? localhost? AdAway? WHAT THE TECH?!!

Aren't you guys just curious on how a short-line of words called URL connects you to the internet? It's not quite magic, but many people have no idea how, they just know it works! In this information-craved, internet-driven era, it's almost impossible to be left in the dark, unless you're still living under a rock.

Now, in this #2 Issue, we'll be touching one of those small things underneath, that let's you explore that magical place of kittens and unicorns, a.k.a the internet!

So, What is "HOSTS" file?
It all boils down to one culprit: the little file known as "HOSTS" file.
It basically exist in every OS that connects to the Internet:
Windows:                              C:\Windows\System32\Drivers\etc\hosts
Linux/unix based OS'es:       /etc/hosts
Apple OSX:                            /private/etc/hosts
Android:                                /system/etc/hosts

Think of it this way: the Hosts file is like an Contact List or a Phonebook. When you type an address like, lets say, en.miui.com into your web browser, the hosts file is first consulted to see if you have the IP address, or the "contact number" for that site. If your host file does have it, then your computer will "call it" and the site will open. If not, your computer will ask the internet's "Global Phonebook or Hotline (Domain Name Server)" for the phone number before it can "call" that site.

I'm at lost, what did you just write?
Just look at the infographic i made, below...

hosts diagram.jpg

Oh, What does the HOSTS file looks like?
Well, it's basically just a text file that contains a local list of IP addresses and URL names.

A sample HOSTS file contents shared below:
# The localhost entry should be in every HOSTS file and is used
# to point back to yourself.

127.0.0.1        localhost

# Just an example
192.168.1.35       test.example.com

# Malicious sites
127.0.0.1  admin.abcde.com
127.0.0.1  www3.abcde.com


Ahem, need more info?

Sentences with # in the beginning are just notes and/or reminders, they don't affect the HOSTS file. Which are in other words called comments.
# Hello! I exist to remind you, be smart!


The directory basically starts with IP Address (space) URL Name - to illustration with example
192.168.1.35 test.example.com192.168.1.36 en.miui.com


What could be done with this HOSTS?
To help you better...

1. Block Unwanted Websites and Ad Sites
Since this is a local directory file and as it consults the HOSTS file first;
You can block sites that you do not want to be accesed in your device, especially those shady or pottentially not lawful sites

A. To do this in your device (Manually)
Make sure your device is ROOTED.

Screenshot_2014-11-29-12-38-50.png

1. Edit your HOSTS file with a text editor from the /system/etc
2. Put in the very bottom of the hosts file "0.0.0.0 (space) the URL of the undesired site", for example

B. To block Ads in your device (Automatic)
It is recomended to download and Install AdAway
AdAway-release_Build-Oct.13.2014.apk (3.27 MB, Downloads: 209)
Favorite6 Share

Rated by 21 people   Experience Reason  

007lopes + 1 Great!
Murabati + 5 Fantastic!
Malathi + 5 Awesome!
Srinivas143 + 1 Fantastic!
Drekavac + 1 Thanks!
TheDorkKnight + 2 Great!
saosin + 2 Thanks!
mgnvratnam + 1 Awesome!
jo.luv.mi + 2 Thanks!
Atyant + 5 Awesome!
Shuddhahnik + 2 Fantastic!
ATP:RedRice + 5 Great!
Czedie + 8 Fantastic!
muharrem + 1 Thanks!
Rodzo + 1 Awesome!
Ivek + 1 Awesome!
volcano619 + 10 Awesome!
luvxiaomi + 5 Awesome!
VineeT.007 + 2 Thanks!
Iyengar + 10 Fantastic work!!!
meredithhan + 10 Awesome!

Experience +80  View Rating Log

Supreme Member

Bugs and Beta Mod

Rank: 7Rank: 7Rank: 7

Credits
23011
Device
Redmi Note 3
MIUI Version
7.11.9
Online time
1153 Hours
Send PM

MIUI 7MIUI 2015Mi 3Redmi 3Redmi 2Fan Of MIUI IndiaMIUI Fan from MalaysiaDiwali MIUI Fan from IndiaFan Of MIUI BangladeshFan of MIUI MyanmarMerry ChristmasMIUI Beta TeamClass A Beta TeamMIUI Device TeamMIUI Beta Team VIPStar Bug FinderMIUI Twitter FollowerRedmi Note 3 ExplorerDie-hard MIUI FanMIUI FB FollowerSenior Beta TesterSuper Moderator

20:57, Nov-29-2014 | Via mobile
|
Awesome work...thanks a lot..

Super moderator

Rank: 8Rank: 8

Credits
341136
Device
Mi Note Pro
MIUI Version
7.11.16
Online time
968 Hours
Send PM

Mi KeyMi BoxMi BandMi In-Ear HeadphonesMi WiFi Router MiniMi WiFi RouterMi Power BankMi HeadphonesXiaomi 7th AnniversaryMIUI 6I Love MIUIMIUI 8Fantastic!FlashholicAwesome!MIUI 2015MIUI 2016MIUI Devices ContestXiaomi Mi 4Mi 3Mi TVRedmi NoteRedmi 1SHilal Ramadan MIUI 9MIUI 100 Million UsersMIUI Fan From Philippines1500K Forum Members1st AnniversaryXiaomi 5th Anniversary600K Forum MembersMIUI 5th AnniversaryHappy Valentine's Day3500K Forum MembersMalaysia AnniversarySuper TuesdayMIUI Forum AppMIUI Fan from TurkeyMIUI 50 Million UsersMIUI Fan From SingaporeMIUI Fan from MalaysiaMIUI 6th AnniversaryMIUI Fan From BrazilMIUI Fan From IndonesiaFan Of MIUI India500K Forum MembersMIUI Happy Medal1 Million Forum App InstallsMIUI 2017300K Forum MembersHappy Singles' DayDiwali I Love 2016Ataturk MourningHappy New Year700K Forum MembersThanksgiving DayHappy DiwaliFan Of MIUI Bangladesh2014 ChristmasMIUI 4th AnniversaryMIUI 7th AnniversarySummer Mi BunnyGamer Mi BunnyI Love Mi BunnyMiPopAlpaca Mi Bunny MIUI ReviewMIUI Beta TeamClass A Beta TeamMIUI Beta Team VIPMi Lover MedalAndroid ElfInbox ZeroYouth PledgeMIUI Community VIPMIUI FollowerHumor MasterDebate MasterUpdates LoverPioneer of MIUI English Forum Die-hard MIUI FanMi TalentSuper ModeratorOTA FeedbackForum Contest LoverMIUI Twitter FollowerWallpaper ExpertMIUI Medals CollectorMost Active MIUIerMIUI Android 4.4 KitKatStar Bug FinderMi Bunny Game Master MIUI FB FollowerAndroid GuruMIUI Global Forum 2014Star Of Icons

23:23, Nov-30-2014 | From PC
|
Awesome work! I can now go around and prank my friends, they won't know how
Follow My Blog for All My Xiaomi Reviews and Unboxings Here!

Platinum Member

Rank: 4

Credits
2495
Device
Mi 3
MIUI Version
6.8.11
Online time
150 Hours
Send PM

Mi BandMi Power BankMIUI 6I Love MIUIFlashholicAwesome!Fantastic!MIUI 2015600K Forum MembersHilal Ramadan 2014 Christmas300K Forum Members1400K Forum MembersMIUI 4th AnniversaryFan Of MIUI IndiaXiaomi 5th AnniversaryMIUI Fan from IndiaMIUI 5th Anniversary1 Million Forum MembersI Love Mi BunnyMIUI Android 4.4 KitKatRingtone Star Inbox ZeroMIUI FollowerRingtone TalentScroll Of WisdomDie-hard MIUI FanMIUI Global Forum 2014Android GuruDebate Master

14:04, Dec-01-2014 | From PC
|
Thanks for this Info. I am using XAD module of Xposed framework. It block all adds. However I don't know, how it worked.

I agreed that is easy way without adding any load to CPU/memory.

Thanks for it.

Moderator

El Psy Congroo!

Rank: 7Rank: 7Rank: 7

Credits
25154
Device
Mi 5
MIUI Version
7.11.21
Online time
676 Hours
Send PM

Mi BoxMi KeyMi BandXiaomi 6 LaunchMi In-Ear HeadphonesMi  BunnyFantastic!Awesome!FlashholicMIUI 2015MIUI 7I Love MIUIMIUI 8MIUI 6MIUI Devices Contest4 Million Forum MembersMi 3Mi NoteMIUI Fan from Malaysia2014 ChristmasThanksgiving DayMIUI Fan From IndonesiaDiwali Fan MIUI PhilippinesMIUI Fan From Singapore1st Anniversary300K Forum MembersMIUI Fan From PhilippinesHappy Singles' DayMIUI 4th AnniversaryMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourMIUI 6th AnniversaryRooster Year of 20173500K Forum MembersSuper MondayMIUI 2017MIUI 91900K Forum Members1 Million Forum MembersMIUI 300 WeeksHappy Valentine's DayMIUI 100 Million UsersMerry ChristmasAlpaca Mi Bunny I Love Mi BunnyGamer Mi BunnyMIUI ReviewTechnology GuruMIUI FollowerMost Active MIUIerMIUI Android 4.4 KitKatForum Contest LoverMIUI Global Forum 2014Mi Lover MedalStar Of IconsDie-hard MIUI FanYouth PledgeHumor MasterScroll Of WisdomAndroid GuruInbox ZeroUpdates LoverMIUI FB Follower

 Author| 14:07, Dec-01-2014 | From PC
|
VineeT.007 replied at 2014-12-1 14:04
Thanks for this Info. I am using XAD module of Xposed framework. It block all adds. However I don't  ...

i also recommend "unbelovedhost" xposed module. Work's just like Xad and AdAway, but with more sources! Thanks for your support!

Elite Member

Rank: 6Rank: 6

Credits
5258
Device
Mi 3
MIUI Version
6.10.20
Online time
198 Hours
Send PM

Mi In-Ear HeadphonesMi BoxMi KeyI Love MIUIAwesome!MIUI 2015MIUI 6MIUI 50 Million Users1 Million Forum Members300K Forum Members100k Forum MembersMIUI 4th AnniversaryFan Of MIUI SpainMIUI 30 Million UsersAlpaca Mi Bunny I Love Mi BunnyMIUI Beta TeamMIUI ReviewPioneer of MIUI English Forum Star Of IconsAndroid ElfOTA FeedbackMIUI Global Forum 2014Forum Contest LoverMIUI FollowerDie-hard MIUI Fan

14:28, Dec-01-2014 | Via mobile
|
really good work buddy. keep it that way

Supreme Member

I love MIUI

Rank: 7Rank: 7Rank: 7

Credits
28567
Device
Mi 3
MIUI Version
7.11.21
Online time
1983 Hours
Send PM

Xiaomi 6 LaunchMi Power BankMi Selfie StickMi VRMi WiFi RouterYeelight Bedside LampMi WiFi Router MiniMi Plastic In-ear PhonesMi USB FanMi T-ShirtMi Bluetooth SpeakerMi BandMi MIXMi KeyMi In-Ear HeadphonesMijia Mi Bunny RobotMi  BunnyMagic CubeMi BoxMi HomeUnlock MedalMi HeadphonesMi Band 2Mijia Qi CycleXiaomi 7th AnniversaryMIUI 8I Love MIUIAwesome!MIUI 6MIUI 2015FlashholicFantastic!MIUI 7MIUI 2016MIUI Devices ContestMi Note ProXiaomi Mi 4Mi NoteRedmi NoteMi 4iMi PadRedmi Note 2Mi 4cRedmiRedmi 3Redmi Note 34 Million Forum MembersRedmi 2Mi TVMi 3Mi 5Hilal Ramadan MIUI Fan From PhilippinesMIUI Fan from IndiaWomen's Day MedalSuper Sunday900K Forum MembersMerry ChristmasFan Of MIUI India800K Forum MembersMIUI 7th AnniversarySingapore BirthdayMIUI 5th AnniversaryMIUI 4th Anniversary700K Forum MembersMIUI 9600K Forum MembersXiaomi 5th Anniversary500K Forum MembersFan Of  MIUI Azerbaijan1st AnniversaryMIUI Fan from MalaysiaMIUI Fan From IndonesiaMIUI Fan From BrazilFan Of MIUI Ex-Yu 90000 Forum MembersFan Of MIUI Bangladesh300K Forum MembersMIUI 50 Million UsersFan Of MIUI Ukraine1 Million Forum MembersHappy Singles' DayThanksgiving DayMIUI Fan From Singapore2014 ChristmasMIUI Fan from Turkey3500K Forum MembersMIUI S1500K Forum MembersMIUI Forum App1400K Forum MembersRooster Year of 2017MIUI 2017Mi Live MedalMIUI 300 Weeks3 Million Forum MembersMIUI 6th AnniversaryOlympics Medal10 Million Forum PostsHappy New YearMIUI Drawing TalentMIUI Lucky FridaySuper TuesdayMalaysia AnniversarySuper FridaySingapore Merlion MedalSurge S1Rocket to FutureSuper MondayFan Of MIUI FranceMIUI 100 Million UsersMIUI World TourSuper WednesdayHappy Valentine's DayPuzzle MasterAtaturk MourningDiwali 5 Million Forum PostsPokemon Master MedalUEFA EURO MedalFan Of MIUI Russia5 Million Forum App InstallsXiaomi 6th AnniversaryMIUI Font LoverMid-Autumn FestivalHappy DiwaliSuper SaturdayFan Of MIUI Greece1300K Forum MembersMIUI Fan From MyanmarMIUI Happy MedalSuper ThursdayMIUI Fan From NepalGamer Mi BunnyI Love Mi BunnySummer Mi BunnyAlpaca Mi Bunny MIUI Beta team - IndiaMIUI ReviewMIUI Beta TeamAndroid ElfInbox ZeroYouth Pledge25 Million StrongTheme TalentMIUI Android 4.4 KitKatAndroid GuruOTA FeedbackTechnology GuruMi Lover MedalRedmi Quiz MasterMi Bunny Game Master Ringtone TalentMi TalentRingtone Star Mr. DependableMIUI Wallpaper ContestMIUI ExpertMaster Of TechnologyStar Of TechnologyMIUI Ice Bucket ChallengeJuly 19 MyanmarMi Story TellerMIUI G+ FollowerScroll Of WisdomMIUI Twitter FollowerForum Contest LoverMost Popular Forum UserMIUI FB FollowerMIUI Global Forum 2014MIUI Medals CollectorStar Of IconsMost Active MIUIerUpdates LoverMIUI FollowerPioneer of MIUI English Forum MIUI KingHumor MasterDebate MasterDie-hard MIUI Fan

14:55, Dec-01-2014 | From PC
|
Very well explained bro. Keep it up.

Elite Member

Work for tomorrow

Rank: 6Rank: 6

Credits
16805
Device
Mi A1
MIUI Version
7.8.31
Online time
643 Hours
Send PM

Magic CubeMi Selfie StickMi HeadphonesMi BandMi KeyMijia Story TellerMi Power BankMi Band 2Mijia Qi CycleMi In-Ear HeadphonesMi HomeMi Power Bank 10000MAH Xiaomi 6 LaunchMi WiFi RouterUnlock MedalMi BoxMi VRXiaomi 7th AnniversaryMIUI 2016MIUI 7MarshmallowFantastic!I Love MIUIFlashholicMIUI 2015MIUI 6MIUI 8Awesome!MIUI Devices ContestMi TVMi PadRedmi 2Redmi Note 2Xiaomi Mi 4Mi 4cMi 3RedmiRedmi 1SMi 4iFan Of MIUI IndiaMIUI Fan From Philippines300K Forum MembersMerry ChristmasMIUI Fan From Singapore900K Forum MembersHappy Diwali800K Forum MembersDiwali MIUI 5th Anniversary600K Forum Members2014 ChristmasFan Of MIUI BangladeshFan Of  MIUI AzerbaijanMIUI Fan from Turkey1st AnniversaryThanksgiving DayAtaturk MourningHappy Valentine's DayMIUI 100 Million UsersHappy Singles' DayMIUI Fan from MalaysiaMIUI Fan From IndonesiaMIUI Fan From BrazilXiaomi 5th AnniversaryHappy New Year500K Forum Members700K Forum MembersMIUI 6th AnniversarySingapore BirthdaySuper FridaySurge S1Rocket to FutureMIUI 2017MIUI Lucky Friday1 Million Forum App InstallsMIUI Monthly TalkRooster Year of 20171 Million Forum MembersMIUI Happy MedalSuper Sunday90000 Forum MembersMIUI Font LoverMIUI 9MIUI 7th AnniversaryPuzzle MasterFan Of MIUI UkraineSuper ThursdaySuper WednesdayMIUI 4th Anniversary3500K Forum MembersFan Of MIUI Russia3 Million Forum App InstallsMIUI 50 Million UsersHilal Ramadan 1800K Forum Members1900K Forum Members1700K Forum MembersMid-Autumn FestivalOlympics MedalMIUI Fan From NepalMIUI 300 WeeksMIUI Forum App1500K Forum MembersMIUI World TourPokemon Master MedalMIUI Fan from IndiaI Love 2016Fan Of MIUI Italy2100K Forum MembersFan Of MIUI PolandAlpaca Mi Bunny MiPopSummer Mi BunnyI Love Mi BunnyGamer Mi BunnyMIUI ReviewMIUI Device TeamMIUI Beta TeamMIUI FollowerMost Active MIUIerAndroid GuruPioneer of MIUI English Forum Humor MasterMIUI Medals CollectorStar Of IconsMi TalentStar Of TechnologyApp TalentMi Lover MedalTechnology GuruMi Bunny Game Master Ringtone Star App TalentMIUI ExpertMost Popular Forum UserTheme TalentMIUI KingMi Story TellerMaster Of TechnologyMIUI G+ FollowerScroll Of WisdomInbox ZeroMIUI Android 4.4 KitKatYouth PledgeUpdates LoverOTA FeedbackDie-hard MIUI FanForum Contest LoverMIUI Twitter FollowerAndroid ElfMIUI FB FollowerMIUI Global Forum 2014Debate Master

15:19, Dec-01-2014 | From PC
|
great work ...thanks a lot
Love MiUi

Elite Member

MIUI Indonesia

Rank: 6Rank: 6

Credits
8188
Device
Redmi 1S
MIUI Version
V8.2.1.0.KHCMIDL
Online time
366 Hours
Send PM

Mi  BunnyMi WiFi RouterMi In-Ear HeadphonesMi MIXMi KeyMi BandMi BoxFantastic!MIUI 2015I Love MIUIMIUI 6FlashholicAwesome!MIUI 8MIUI 7Redmi 1SRedmi NoteMi 1Redmi Note 2Mi 4iRedmiMi TVMi 3Thanksgiving DayHappy Singles' DayMIUI Fan from Malaysia1st AnniversaryMIUI V5 ReviewMIUI Fan From Indonesia300K Forum MembersFan Of MIUI Ex-Yu MIUI Fan From SingaporeMIUI Fan From PhilippinesMIUI 50 Million Users2014 ChristmasHappy DiwaliMIUI 5th Anniversary600K Forum MembersMIUI Fan From BrazilMIUI Fan From MyanmarDiwali 1800K Forum Members1500K Forum MembersAtaturk MourningMIUI Fan from IndiaMIUI 100 Million UsersMIUI 4th AnniversaryMIUI Fan from TurkeyHilal Ramadan Fan Of MIUI BangladeshFan Of  MIUI AzerbaijanHappy Valentine's DayHappy New YearFan Of MIUI IndiaSummer Mi BunnyAlpaca Mi Bunny I Love Mi BunnyGamer Mi BunnyMIUI News TeamMIUI Beta TeamAndroid ElfPioneer of MIUI English Forum MIUI Global Forum 2014MIUI FB FollowerMi Bunny Game Master Debate MasterInbox ZeroYouth PledgeMi Lover MedalForum Contest LoverOTA FeedbackHumor MasterUpdates LoverStar Of IconsMost Active MIUIerIndustrious ReporterMIUI Android 4.4 KitKatMIUI Medals CollectorDie-hard MIUI FanMIUI FollowerAndroid GuruRedmi Quiz Master

18:14, Dec-01-2014 | From PC
|
nice one dude

Diamond Member

Rank: 5Rank: 5

Credits
1475
Device
Redmi 4
MIUI Version
V9.1.1.0.NAMMIEI
Online time
120 Hours
Send PM

Mi VRXiaomi 6 LaunchMijia VR Play 2Mi Bluetooth SpeakerMi Band 2Mi HomeMi BandMi VR HeadsetMi Water PurifierMi Selfie StickUnlock MedalMi Power Bank 10000MAH Mi TV 70Mi BoxMi HeadphonesXiaomi 7th AnniversaryMIUI 2016MIUI 7MIUI Devices ContestFantastic!MIUI 8I Love MIUIMi NoteRedmi 1SMi TVMi 4iRedmi NoteRedmi 22100K Forum MembersMIUI Marathon MedalPokemon Master MedalMIUI Fan from TurkeyMerry ChristmasMIUI Monthly TalkMIUI 20171400K Forum Members1 Million Forum App InstallsI Love 20162014 ChristmasMIUI 4th Anniversary1 Million Forum MembersFan Of MIUI IndiaMIUI Fan From SingaporeMIUI Fan From BrazilRooster Year of 2017UEFA EURO MedalMid-Autumn FestivalMIUI 300 WeeksHappy Valentine's DayMIUI 6th AnniversaryMIUI Fan From IndonesiaHappy New YearRocket to Future3500K Forum MembersHappy Holi MedalMIUI Lucky Friday5 Million Forum App InstallsFan Of MIUI AustraliaMIUI World TourMIUI 7th AnniversaryMIUI 9300K Forum MembersMIUI Fan From PhilippinesSuper ThursdayMIUI Forum App10 Million Forum PostsMIUI 50 Million Users3 Million Forum MembersSurge S1Super MondaySummer Mi BunnyI Love Mi BunnyAlpaca Mi Bunny MiPopMIUI Halloween 2017Master Of TechnologyPioneer of MIUI English Forum Most Active MIUIerMIUI FollowerMIUI Global Forum 2014India Independence DayMIUI G+ FollowerAndroid GuruAndroid Elf25 Million StrongUpdates LoverScroll Of WisdomMi Lover MedalMi TalentForum Contest LoverOTA FeedbackMi Story TellerYouth PledgeStar Of TechnologyDie-hard MIUI FanDebate MasterTechnology GuruMIUI ExpertMIUI Medals CollectorMIUI FB FollowerIndonesia Independence Day

19:10, Dec-01-2014 | Via mobile
|
Cool tips...  Good sharing...

Credits Management

Quick Reply Top Return to the list