Xiaomi MIUI Official Forum

Intern Moderator

My Brain... Trembles!!!

Rank: 7Rank: 7Rank: 7

Credits
23842
Device
Mi 5
MIUI Version
7.10.17
Online time
663 Hours
Send PM

Mi KeyMi BandXiaomi 6 LaunchMi BoxMi In-Ear HeadphonesMi  BunnyMIUI 6Awesome!MIUI 7FlashholicMIUI 8I Love MIUIMIUI Devices ContestMIUI 2015Fantastic!Mi 34 Million Forum MembersMi NoteMIUI 4th AnniversarySuper MondayMIUI Fan From SingaporeMIUI Fan From IndonesiaDiwali MIUI Halloween2014 ChristmasMIUI Fan From PhilippinesHappy Singles' DayThanksgiving DayHappy Valentine's DayMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourRooster Year of 20173500K Forum MembersMIUI 2017MIUI 91900K Forum MembersMIUI 300 WeeksMIUI 6th Anniversary1st AnniversaryFan MIUI Philippines300K Forum MembersMIUI 100 Million Users1 Million Forum MembersMIUI Fan from MalaysiaMerry ChristmasGamer Mi BunnyAlpaca Mi Bunny I Love Mi BunnyMIUI ReviewMIUI FollowerMIUI Android 4.4 KitKatMost Active MIUIerMIUI Global Forum 2014MIUI FB FollowerForum Contest LoverAndroid GuruScroll Of WisdomHumor MasterInbox ZeroUpdates LoverDie-hard MIUI FanYouth PledgeStar Of Icons

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

[ Promote]
7589 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: 205)
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
23013
Device
Redmi Note 3
MIUI Version
7.6.14
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
339005
Device
Mi Note Pro
MIUI Version
7.10.18
Online time
963 Hours
Send PM

Mi WiFi Router MiniMi Power BankMi In-Ear HeadphonesMi KeyMi BandMi WiFi RouterMi HeadphonesMi BoxXiaomi 7th AnniversaryMIUI Devices ContestFantastic!FlashholicMIUI 2015Awesome!MIUI 8I Love MIUIMIUI 6MIUI 2016Mi 3Xiaomi Mi 4Redmi 1SRedmi NoteMi TV1st AnniversaryMIUI 4th AnniversaryMIUI Fan From BrazilXiaomi 5th AnniversaryHappy DiwaliMIUI 7th AnniversaryHilal Ramadan 600K Forum MembersMIUI 5th AnniversaryMalaysia AnniversaryMIUI 50 Million UsersMIUI Fan from TurkeyFan Of MIUI BangladeshHappy New YearMIUI Fan From PhilippinesMIUI Fan From SingaporeDiwali Fan Of MIUI IndiaAtaturk MourningMIUI 100 Million UsersMIUI Fan from MalaysiaMIUI Fan From Indonesia500K Forum Members1 Million Forum App InstallsMIUI HalloweenHappy Valentine's DayI Love 20161500K Forum Members700K Forum MembersMIUI 6th AnniversaryMIUI Forum App300K Forum MembersMIUI 20173500K Forum MembersSuper TuesdayHappy Singles' DayThanksgiving Day2014 ChristmasMIUI 9MiPopI Love Mi BunnyAlpaca Mi Bunny Gamer Mi BunnySummer Mi BunnyMIUI ReviewClass A Beta TeamMIUI Beta TeamMIUI Beta Team VIPMi TalentAndroid ElfInbox ZeroYouth PledgeSuper ModeratorMi Lover MedalAndroid GuruStar Of IconsMi Bunny Game Master Star Bug FinderMIUI Community VIPForum Contest LoverMIUI Global Forum 2014MIUI FB FollowerMIUI Twitter FollowerWallpaper ExpertMIUI Medals CollectorMIUI FollowerPioneer of MIUI English Forum Die-hard MIUI FanMIUI Android 4.4 KitKatHumor MasterMost Active MIUIerUpdates LoverDebate MasterOTA Feedback

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 MembersMIUI Halloween1400K Forum MembersMIUI 4th AnniversaryFan Of MIUI India1 Million Forum MembersMIUI Fan from IndiaXiaomi 5th AnniversaryMIUI 5th AnniversaryI Love Mi BunnyInbox ZeroRingtone Star MIUI Android 4.4 KitKatAndroid GuruRingtone TalentScroll Of WisdomMIUI Global Forum 2014MIUI FollowerDebate MasterDie-hard MIUI Fan

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.

Intern Moderator

My Brain... Trembles!!!

Rank: 7Rank: 7Rank: 7

Credits
23842
Device
Mi 5
MIUI Version
7.10.17
Online time
663 Hours
Send PM

Mi KeyMi BandXiaomi 6 LaunchMi BoxMi In-Ear HeadphonesMi  BunnyMIUI 6Awesome!MIUI 7FlashholicMIUI 8I Love MIUIMIUI Devices ContestMIUI 2015Fantastic!Mi 34 Million Forum MembersMi NoteMIUI 4th AnniversarySuper MondayMIUI Fan From SingaporeMIUI Fan From IndonesiaDiwali MIUI Halloween2014 ChristmasMIUI Fan From PhilippinesHappy Singles' DayThanksgiving DayHappy Valentine's DayMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourRooster Year of 20173500K Forum MembersMIUI 2017MIUI 91900K Forum MembersMIUI 300 WeeksMIUI 6th Anniversary1st AnniversaryFan MIUI Philippines300K Forum MembersMIUI 100 Million Users1 Million Forum MembersMIUI Fan from MalaysiaMerry ChristmasGamer Mi BunnyAlpaca Mi Bunny I Love Mi BunnyMIUI ReviewMIUI FollowerMIUI Android 4.4 KitKatMost Active MIUIerMIUI Global Forum 2014MIUI FB FollowerForum Contest LoverAndroid GuruScroll Of WisdomHumor MasterInbox ZeroUpdates LoverDie-hard MIUI FanYouth PledgeStar Of Icons

 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
27882
Device
Mi 3
MIUI Version
7.10.17
Online time
1971 Hours
Send PM

Mi HeadphonesMi BoxMi Power BankMi In-Ear HeadphonesMi Plastic In-ear PhonesMi T-ShirtMi USB FanMi Selfie StickMi WiFi RouterUnlock MedalMi Band 2Mi HomeMi BandMijia Mi Bunny RobotYeelight Bedside LampMi Bluetooth SpeakerMi KeyMi WiFi Router MiniMi MIXMagic CubeMi VRMi  BunnyXiaomi 6 LaunchMijia Qi CycleXiaomi 7th AnniversaryMIUI Devices ContestI Love MIUIAwesome!MIUI 7Fantastic!FlashholicMIUI 6MIUI 8MIUI 2016MIUI 2015Redmi 3Mi Note ProRedmi Note 3Mi Note4 Million Forum MembersRedmi 2Redmi Note 2Mi 3Redmi NoteMi PadMi TVMi 5Xiaomi Mi 4RedmiMi 4iMi 4c800K Forum MembersMIUI Halloween900K Forum Members700K Forum MembersMIUI 5th Anniversary600K Forum MembersSingapore BirthdayMIUI 4th AnniversaryHilal Ramadan MIUI Fan from IndiaMIUI 50 Million UsersMIUI Fan From PhilippinesMid-Autumn FestivalHappy DiwaliMIUI 100 Million UsersMalaysia AnniversaryHappy New YearHappy Valentine's DayDiwali Ataturk MourningMIUI Fan from TurkeyMIUI Fan From SingaporeFan Of  MIUI Azerbaijan500K Forum MembersFan Of MIUI Bangladesh2014 ChristmasHappy Singles' DayThanksgiving DayXiaomi 5th Anniversary1 Million Forum MembersFan Of MIUI Ex-Yu MIUI Fan from MalaysiaFan Of MIUI IndiaMIUI Fan From Indonesia1st AnniversaryMIUI Fan From Brazil300K Forum MembersMerry ChristmasSuper TuesdayRocket to FutureSuper MondaySuper FridaySingapore Merlion MedalWomen's Day MedalSurge S1MIUI World TourMIUI Lucky FridayMIUI Forum AppMi Live Medal1500K Forum Members1400K Forum MembersMIUI 2017Rooster Year of 2017Super WednesdayFan Of MIUI France3500K Forum MembersSuper SundayMIUI Font LoverFan Of MIUI Ukraine90000 Forum MembersMIUI 7th AnniversaryMIUI 9Super Saturday5 Million Forum App Installs3 Million Forum Members10 Million Forum PostsPuzzle MasterSuper ThursdayFan Of MIUI RussiaMIUI Happy MedalMIUI 300 WeeksMIUI Drawing TalentPokemon Master MedalXiaomi 6th AnniversaryMIUI Fan From MyanmarFan Of MIUI GreeceMIUI Fan From NepalMIUI 6th Anniversary1300K Forum MembersUEFA EURO Medal5 Million Forum PostsOlympics MedalI Love Mi BunnyGamer Mi BunnyAlpaca Mi Bunny Summer Mi BunnyMIUI ReviewMIUI Beta team - IndiaMIUI Beta TeamRedmi Quiz MasterMi Lover MedalMi TalentMIUI G+ Follower25 Million StrongMIUI Wallpaper ContestTechnology GuruMr. DependableRingtone TalentYouth PledgeMost Popular Forum UserMIUI Ice Bucket ChallengeInbox ZeroRingtone Star Theme TalentAndroid ElfMIUI KingMIUI Android 4.4 KitKatJuly 19 MyanmarMi Bunny Game Master MIUI ExpertHumor MasterUpdates LoverMi Story TellerForum Contest LoverMIUI Twitter FollowerMIUI FB FollowerMIUI Global Forum 2014Star Of IconsMIUI Medals CollectorOTA FeedbackStar Of TechnologyAndroid GuruDebate MasterDie-hard MIUI FanPioneer of MIUI English Forum Most Active MIUIerMaster Of TechnologyMIUI FollowerScroll Of Wisdom

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

Elite Member

Work for tomorrow

Rank: 6Rank: 6

Credits
16532
Device
Mi A1
MIUI Version
7.8.31
Online time
635 Hours
Send PM

Mi Selfie StickMijia Qi CycleMagic CubeMi HeadphonesMi KeyMi Band 2Mi WiFi RouterMijia Story TellerMi Power BankMi Power Bank 10000MAH Mi HomeMi In-Ear HeadphonesXiaomi 6 LaunchMi BandUnlock MedalMi VRMi BoxXiaomi 7th AnniversaryMarshmallowMIUI 2016MIUI 8Fantastic!MIUI Devices ContestFlashholicMIUI 7Awesome!MIUI 2015MIUI 6I Love MIUIRedmi 2Mi 4cXiaomi Mi 4Mi 3Mi PadMi TVMi 4iRedmi 1SRedmiRedmi Note 2MIUI Fan From Indonesia800K Forum Members700K Forum MembersFan Of MIUI India900K Forum MembersMIUI Fan From SingaporeMIUI 5th AnniversaryFan Of  MIUI AzerbaijanAtaturk MourningHappy Singles' DayThanksgiving Day1st AnniversaryMIUI HalloweenHappy DiwaliDiwali 300K Forum MembersMIUI Fan From PhilippinesMIUI Fan from Turkey2014 Christmas500K Forum MembersXiaomi 5th AnniversaryMIUI Fan From Brazil600K Forum MembersHappy New YearMIUI 100 Million UsersFan Of MIUI BangladeshMerry ChristmasHappy Valentine's DayMIUI Fan from MalaysiaMIUI 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 PolandGamer Mi BunnyAlpaca Mi Bunny Summer Mi BunnyI Love Mi BunnyMiPopMIUI Device TeamMIUI Beta TeamMIUI ReviewAndroid GuruMIUI FollowerPioneer of MIUI English Forum Humor MasterStar Of IconsMost Active MIUIerMIUI Medals CollectorMi TalentStar Of TechnologyApp TalentMi Lover MedalTechnology GuruRingtone Star App TalentMIUI ExpertMost Popular Forum UserTheme TalentMIUI KingMi Story TellerMaster Of TechnologyMi Bunny Game Master MIUI G+ FollowerInbox ZeroMIUI Android 4.4 KitKatYouth PledgeUpdates LoverOTA FeedbackForum Contest LoverMIUI FB FollowerDebate MasterScroll Of WisdomMIUI Twitter FollowerAndroid ElfMIUI Global Forum 2014Die-hard MIUI Fan

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

Elite Member

MIUI Indonesia

Rank: 6Rank: 6

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

Mi  BunnyMi BoxMi MIXMi WiFi RouterMi In-Ear HeadphonesMi KeyMi BandMIUI 2015MIUI 6MIUI 7I Love MIUIFantastic!Awesome!MIUI 8FlashholicMi 3Redmi 1SRedmiRedmi NoteMi 1Mi TVRedmi Note 2Mi 4iFan Of MIUI Ex-Yu MIUI Fan from MalaysiaMIUI Fan From SingaporeMIUI 5th AnniversaryMIUI 50 Million UsersHappy DiwaliMIUI Fan From MyanmarMIUI Halloween1500K Forum Members1800K Forum MembersMIUI V5 ReviewAtaturk MourningDiwali 1st Anniversary300K Forum MembersHappy Singles' Day2014 ChristmasMIUI Fan From IndonesiaMIUI 4th AnniversaryFan Of MIUI BangladeshHappy New YearFan Of MIUI IndiaHappy Valentine's DayMIUI Fan from TurkeyHilal Ramadan MIUI Fan From Brazil600K Forum MembersFan Of  MIUI AzerbaijanThanksgiving DayMIUI Fan From PhilippinesMIUI 100 Million UsersMIUI Fan from 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 LoverRedmi Quiz MasterHumor MasterUpdates LoverStar Of IconsMIUI Medals CollectorIndustrious ReporterMIUI Android 4.4 KitKatOTA FeedbackDie-hard MIUI FanMIUI FollowerAndroid GuruMost Active MIUIer

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

Diamond Member

Rank: 5Rank: 5

Credits
1251
Device
Redmi 1S
MIUI Version
7.9.18
Online time
111 Hours
Send PM

Mi Water PurifierMi BandMijia VR Play 2Mi Selfie StickMi VRXiaomi 6 LaunchUnlock MedalMi Bluetooth SpeakerMi HeadphonesMi HomeMi VR HeadsetMi Band 2Mi Power Bank 10000MAH Xiaomi 7th AnniversaryMIUI Devices ContestMIUI 7MIUI 2016Fantastic!I Love MIUIMIUI 8Redmi 2Mi 4iRedmi 1SMi NoteRedmi NoteMi TV2100K Forum MembersMIUI Marathon MedalHappy New YearPokemon Master Medal1400K Forum Members1 Million Forum App InstallsI Love 2016MIUI 20171 Million Forum MembersMIUI 4th AnniversaryHappy Valentine's Day2014 ChristmasMIUI Fan From IndonesiaFan Of MIUI IndiaMIUI Fan From BrazilMIUI Fan From SingaporeMIUI 300 WeeksMIUI 6th AnniversaryUEFA EURO MedalMerry ChristmasMid-Autumn FestivalMIUI Monthly Talk300K Forum MembersMIUI Forum App5 Million Forum App InstallsMIUI 9Super ThursdayRooster Year of 2017Happy Holi MedalFan Of MIUI Australia3500K Forum MembersRocket to FutureMIUI World TourMIUI Fan from TurkeyMIUI 7th Anniversary10 Million Forum PostsSurge S1MIUI Lucky Friday3 Million Forum MembersMIUI Fan From PhilippinesSuper MondaySummer Mi BunnyI Love Mi BunnyMiPopAlpaca Mi Bunny MIUI Global Forum 2014India Independence DayIndonesia Independence Day25 Million StrongAndroid GuruPioneer of MIUI English Forum Most Active MIUIerMIUI FollowerMIUI FB FollowerStar Of TechnologyMi Story TellerUpdates LoverDie-hard MIUI FanAndroid ElfMaster Of TechnologyForum Contest LoverMi TalentMIUI Medals CollectorMIUI ExpertScroll Of WisdomMi Lover MedalDebate MasterTechnology Guru

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

Credits Management

Quick Reply Top Return to the list