Xiaomi MIUI Official Forum

Moderator

My Brain... Trembles!!!

Rank: 7Rank: 7Rank: 7

Credits
22681
Device
Mi 5
MIUI Version
7.8.17
Online time
642 Hours
Send PM

Mi In-Ear HeadphonesXiaomi 6 LaunchMi BandMi KeyMi BoxAwesome!FlashholicMIUI 7MIUI 2015MIUI 8Fantastic!MIUI Devices ContestI Love MIUIMIUI 64 Million Forum MembersMi NoteMi 3MIUI Fan From PhilippinesThanksgiving DayMIUI 9MIUI HalloweenDiwali 300K Forum MembersMIUI Fan From IndonesiaMIUI 4th AnniversaryMIUI Fan From SingaporeHappy Singles' DayFan MIUI PhilippinesMIUI World TourMIUI 300 WeeksMIUI 6th AnniversaryMIUI Fan from TurkeyMIUI Lucky Friday1900K Forum Members3500K Forum MembersRooster Year of 2017Merry Christmas1 Million Forum Members1st Anniversary2014 ChristmasHappy Valentine's DayMIUI Fan from MalaysiaMIUI 100 Million UsersAlpaca Mi Bunny Gamer Mi BunnyI Love Mi BunnyMIUI ReviewMost Active MIUIerMIUI Android 4.4 KitKatMIUI FollowerForum Contest LoverMIUI FB FollowerMIUI Global Forum 2014Android 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]
7205 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: 201)
Favorite5 Share

Rated by 20 people   Experience Reason  

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 +79  View Rating Log

Supreme Member

Bugs and Beta Mod

Rank: 7Rank: 7Rank: 7

Credits
22989
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
337327
Device
Mi Note Pro
MIUI Version
7.8.14
Online time
952 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.

Moderator

My Brain... Trembles!!!

Rank: 7Rank: 7Rank: 7

Credits
22681
Device
Mi 5
MIUI Version
7.8.17
Online time
642 Hours
Send PM

Mi In-Ear HeadphonesXiaomi 6 LaunchMi BandMi KeyMi BoxAwesome!FlashholicMIUI 7MIUI 2015MIUI 8Fantastic!MIUI Devices ContestI Love MIUIMIUI 64 Million Forum MembersMi NoteMi 3MIUI Fan From PhilippinesThanksgiving DayMIUI 9MIUI HalloweenDiwali 300K Forum MembersMIUI Fan From IndonesiaMIUI 4th AnniversaryMIUI Fan From SingaporeHappy Singles' DayFan MIUI PhilippinesMIUI World TourMIUI 300 WeeksMIUI 6th AnniversaryMIUI Fan from TurkeyMIUI Lucky Friday1900K Forum Members3500K Forum MembersRooster Year of 2017Merry Christmas1 Million Forum Members1st Anniversary2014 ChristmasHappy Valentine's DayMIUI Fan from MalaysiaMIUI 100 Million UsersAlpaca Mi Bunny Gamer Mi BunnyI Love Mi BunnyMIUI ReviewMost Active MIUIerMIUI Android 4.4 KitKatMIUI FollowerForum Contest LoverMIUI FB FollowerMIUI Global Forum 2014Android 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
27488
Device
Mi 3
MIUI Version
7.6.8
Online time
1876 Hours
Send PM

Mi In-Ear HeadphonesMijia Mi Bunny RobotMi Power BankMi KeyMi BoxMi BandMi WiFi RouterMi Band 2Mi HeadphonesMi USB FanMi T-ShirtMi Bluetooth SpeakerMi WiFi Router MiniYeelight Bedside LampUnlock MedalMi HomeMi Plastic In-ear PhonesMi Selfie StickMi VRXiaomi 6 LaunchMi MIXXiaomi 7th AnniversaryMIUI Devices ContestAwesome!MIUI 8MIUI 2015MIUI 7I Love MIUIMIUI 2016MIUI 6Fantastic!FlashholicRedmi 2Redmi Note 3Mi 3Mi 4cRedmi Note 2Mi 4i4 Million Forum MembersMi 5Xiaomi Mi 4Redmi 3Redmi NoteMi PadMi Note ProMi TVMi NoteRedmiSingapore Birthday1st AnniversaryMIUI 9Fan Of  MIUI AzerbaijanMIUI 4th Anniversary1 Million Forum MembersXiaomi 6th AnniversaryMerry ChristmasMIUI 5th AnniversaryMIUI Fan from Turkey600K Forum MembersXiaomi 5th AnniversaryMIUI 50 Million UsersMIUI HalloweenThanksgiving Day300K Forum MembersMIUI Fan From Philippines2014 Christmas800K Forum MembersMIUI Fan From SingaporeFan Of MIUI BangladeshHilal Ramadan Happy Singles' Day700K Forum MembersMIUI Fan from India900K Forum MembersUEFA EURO Medal10 Million Forum PostsFan Of MIUI France3 Million Forum MembersPuzzle MasterHappy Valentine's DaySuper WednesdayWomen's Day MedalSuper TuesdayMIUI Fan From BrazilSuper FridaySingapore Merlion MedalSurge S1Super ThursdayMIUI Happy MedalMIUI 100 Million UsersFan Of MIUI UkraineMIUI Fan From Indonesia90000 Forum MembersMalaysia AnniversaryHappy New Year3500K Forum Members5 Million Forum App InstallsFan Of MIUI RussiaSuper SaturdayMIUI Font LoverSuper SundayRocket to FutureSuper MondayMIUI Fan From NepalFan Of MIUI GreeceMIUI Fan From MyanmarFan Of MIUI Ex-Yu Pokemon Master Medal500K Forum Members1300K Forum MembersMid-Autumn FestivalFan Of MIUI IndiaHappy DiwaliDiwali 5 Million Forum PostsMIUI 6th AnniversaryOlympics MedalMIUI 2017Rooster Year of 2017MIUI Drawing TalentMIUI Lucky FridayMIUI World Tour1400K Forum Members1500K Forum MembersAtaturk MourningMIUI 300 WeeksMi Live MedalMIUI Forum AppMIUI Fan from MalaysiaSummer Mi BunnyGamer Mi BunnyI Love Mi BunnyAlpaca Mi Bunny MIUI Beta TeamMIUI ReviewMIUI Beta team - IndiaAndroid ElfAndroid GuruYouth PledgeMIUI Android 4.4 KitKatInbox ZeroRingtone Star Mr. DependableMIUI Wallpaper ContestJuly 19 MyanmarRedmi Quiz MasterMi Lover MedalMi Bunny Game Master Technology GuruMi Story TellerStar Of TechnologyMost Popular Forum UserTheme TalentMIUI KingMIUI Ice Bucket ChallengeMIUI ExpertMaster Of TechnologyRingtone TalentMi TalentMIUI Twitter FollowerForum Contest LoverUpdates LoverMIUI FB FollowerMIUI Global Forum 2014MIUI Medals CollectorStar Of IconsHumor MasterMIUI FollowerScroll Of WisdomMIUI G+ FollowerDebate MasterOTA FeedbackPioneer of MIUI English Forum Die-hard MIUI FanMost Active MIUIer

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

Elite Member

Work for tomorrow

Rank: 6Rank: 6

Credits
16225
Device
Mi 3
MIUI Version
7.6.8
Online time
626 Hours
Send PM

Mi HeadphonesMi Band 2Xiaomi 6 LaunchMijia Story TellerMi Power Bank 10000MAH Magic CubeMi Selfie StickMi BoxMi HomeMi VRMi KeyUnlock MedalMi BandMi In-Ear HeadphonesMi Power BankMi WiFi RouterXiaomi 7th AnniversaryMIUI 7MarshmallowMIUI 6MIUI 2015I Love MIUIFlashholicMIUI 8MIUI Devices ContestAwesome!MIUI 2016Fantastic!Mi TVMi 4iRedmiMi PadRedmi Note 2Mi 4cMi 3Xiaomi Mi 4Redmi 2Redmi 1SMIUI 100 Million UsersHappy New YearMIUI Fan from Malaysia700K Forum MembersMIUI 7th Anniversary600K Forum MembersMIUI Fan From BrazilXiaomi 5th Anniversary500K Forum MembersHappy Singles' DayFan Of MIUI IndiaMIUI Fan From Indonesia1st AnniversaryDiwali MIUI Fan From SingaporeMIUI 50 Million UsersMIUI 4th AnniversarySingapore BirthdayHilal Ramadan MIUI Fan from India300K Forum MembersMIUI Fan From PhilippinesMIUI Fan from Turkey2014 ChristmasFan Of MIUI BangladeshFan Of  MIUI AzerbaijanThanksgiving Day800K Forum MembersHappy DiwaliMIUI HalloweenAtaturk MourningHappy Valentine's DayMIUI 5th AnniversaryPokemon Master Medal3500K Forum MembersSuper WednesdayI Love 20162100K Forum MembersMIUI World TourFan Of MIUI PolandFan Of MIUI UkraineFan Of MIUI ItalyRocket to FutureMIUI Happy MedalFan Of MIUI Russia3 Million Forum App InstallsSuper FridayMIUI Lucky FridayMIUI 2017Rooster Year of 2017MIUI Monthly TalkSurge S1Super Thursday1 Million Forum App InstallsSuper SundayMIUI Forum AppMIUI 6th AnniversaryOlympics Medal90000 Forum MembersMIUI Fan From NepalMIUI Font LoverMIUI 9900K Forum MembersMerry Christmas1 Million Forum MembersMIUI 300 WeeksPuzzle Master1500K Forum Members1800K Forum Members1700K Forum Members1900K Forum MembersMid-Autumn FestivalMiPopGamer Mi BunnySummer Mi BunnyAlpaca Mi Bunny I Love Mi BunnyMIUI ReviewMIUI Device TeamMIUI Beta TeamHumor MasterAndroid GuruMost Popular Forum UserTheme TalentMIUI KingMi Story TellerMIUI Medals CollectorMost Active MIUIerStar Of IconsInbox ZeroMi Lover MedalMIUI Twitter FollowerStar Of TechnologyAndroid ElfApp TalentDebate MasterScroll Of WisdomRingtone Star Mi TalentMIUI G+ FollowerTechnology GuruMIUI Global Forum 2014MIUI FB FollowerUpdates LoverMaster Of TechnologyOTA FeedbackDie-hard MIUI FanPioneer of MIUI English Forum Youth PledgeMi Bunny Game Master App TalentForum Contest LoverMIUI ExpertMIUI Android 4.4 KitKatMIUI Follower

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

Elite Member

MIUI Indonesia

Rank: 6Rank: 6

Credits
8187
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
1054
Device
Redmi 1S
MIUI Version
7.5.25
Online time
104 Hours
Send PM

Mi Band 2Mi Selfie StickXiaomi 6 LaunchMi VRMi HomeMi BandMijia VR Play 2Mi Water PurifierMi Power Bank 10000MAH Unlock MedalMi VR HeadsetMi Bluetooth SpeakerXiaomi 7th AnniversaryMIUI Devices ContestMIUI 7MIUI 8MIUI 2016Fantastic!I Love MIUIRedmi 1SRedmi NoteMi TVRedmi 2Mi NoteMi 4iFan Of MIUI IndiaMid-Autumn Festival1400K Forum MembersMIUI Marathon MedalMIUI 300 WeeksPokemon Master Medal2100K Forum Members2014 ChristmasHappy Valentine's DayMIUI Fan From SingaporeI Love 2016MIUI 4th Anniversary1 Million Forum MembersMIUI 6th AnniversaryMIUI Fan From BrazilUEFA EURO MedalMIUI Fan From Indonesia1 Million Forum App Installs5 Million Forum App InstallsMIUI Forum AppSuper ThursdaySuper Monday10 Million Forum PostsHappy Holi MedalRocket to Future300K Forum MembersMIUI World TourFan Of MIUI Australia3500K Forum MembersSurge S13 Million Forum MembersMerry ChristmasMIUI 2017Happy New YearMIUI 9MIUI Monthly TalkRooster Year of 2017MIUI Lucky FridayI Love Mi BunnyMiPopSummer Mi BunnyAlpaca Mi Bunny Master Of TechnologyDie-hard MIUI FanMi Lover MedalMIUI Global Forum 2014MIUI FollowerMost Active MIUIerPioneer of MIUI English Forum MIUI Medals CollectorDebate MasterForum Contest LoverTechnology GuruMi TalentMi Story TellerScroll Of WisdomMIUI FB FollowerMIUI ExpertUpdates LoverAndroid ElfStar Of Technology

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

Credits Management

Quick Reply Top Return to the list