Xiaomi MIUI Official Forum

Moderator

My Brain... Trembles!!!

Rank: 7Rank: 7Rank: 7

Credits
21684
Device
Mi 5
MIUI Version
7.6.8
Online time
634 Hours
Send PM

Mi BoxMi In-Ear HeadphonesMi KeyMi BandXiaomi 6 LaunchI Love MIUIMIUI 6MIUI 2015Fantastic!FlashholicAwesome!MIUI 7MIUI 8Mi 3Mi NoteRooster Year of 2017MIUI HalloweenMIUI Fan from MalaysiaMIUI Fan From PhilippinesHappy Singles' DayMIUI Fan From Indonesia1900K Forum MembersMIUI Fan From Singapore300K Forum Members3500K Forum Members1st AnniversaryDiwali Thanksgiving Day1 Million Forum MembersMerry ChristmasMIUI 100 Million UsersMIUI 6th AnniversaryMIUI 300 WeeksMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourFan MIUI PhilippinesHappy Valentine's Day2014 ChristmasMIUI 4th AnniversaryAlpaca Mi Bunny Gamer Mi BunnyI Love Mi BunnyMIUI ReviewScroll Of WisdomHumor MasterMIUI FB FollowerMIUI FollowerMIUI Global Forum 2014MIUI Android 4.4 KitKatInbox ZeroUpdates LoverForum Contest LoverStar Of IconsAndroid GuruDie-hard MIUI FanYouth PledgeMost Active MIUIer

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

[ Promote]
6760 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: 200)
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
22972
Device
Redmi Note 3
MIUI Version
V8.1.4.0.MXEMIDI
Online time
1152 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..

Moderator

Rank: 7Rank: 7Rank: 7

Credits
335780
Device
Mi Note Pro
MIUI Version
7.6.9
Online time
935 Hours
Send PM

Mi WiFi Router MiniMi BandMi Power BankMi WiFi RouterMi HeadphonesMi KeyMi BoxMi In-Ear HeadphonesXiaomi 7th AnniversaryMIUI 8I Love MIUIMIUI 6Awesome!MIUI Devices ContestMIUI 2016FlashholicFantastic!MIUI 2015Xiaomi Mi 4Redmi 1SMi 3Redmi NoteMi TV1st AnniversaryHappy New YearMIUI Fan From BrazilMIUI 100 Million UsersMIUI 5th Anniversary500K Forum MembersMalaysia Anniversary3500K Forum Members600K Forum MembersMIUI Fan From IndonesiaAtaturk MourningHilal Ramadan MIUI Fan from TurkeyMIUI Fan From PhilippinesMIUI 50 Million UsersMIUI 4th AnniversaryHappy DiwaliDiwali MIUI Fan from MalaysiaMIUI Fan From SingaporeFan Of MIUI IndiaXiaomi 5th AnniversaryHappy Singles' Day700K Forum Members1 Million Forum App Installs300K Forum MembersMIUI HalloweenMIUI 6th AnniversaryMIUI Forum App1500K Forum MembersThanksgiving DayI Love 2016Happy Valentine's Day2014 ChristmasSuper TuesdayMIUI 2017Fan Of MIUI BangladeshI Love Mi BunnyMiPopAlpaca Mi Bunny Gamer Mi BunnySummer Mi BunnyClass A Beta TeamMIUI ReviewMIUI Beta Team VIPMIUI Beta TeamSuper ModeratorYouth PledgeMi TalentInbox ZeroMi Lover MedalAndroid ElfAndroid 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 FanHumor MasterMIUI Android 4.4 KitKatMost 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
21684
Device
Mi 5
MIUI Version
7.6.8
Online time
634 Hours
Send PM

Mi BoxMi In-Ear HeadphonesMi KeyMi BandXiaomi 6 LaunchI Love MIUIMIUI 6MIUI 2015Fantastic!FlashholicAwesome!MIUI 7MIUI 8Mi 3Mi NoteRooster Year of 2017MIUI HalloweenMIUI Fan from MalaysiaMIUI Fan From PhilippinesHappy Singles' DayMIUI Fan From Indonesia1900K Forum MembersMIUI Fan From Singapore300K Forum Members3500K Forum Members1st AnniversaryDiwali Thanksgiving Day1 Million Forum MembersMerry ChristmasMIUI 100 Million UsersMIUI 6th AnniversaryMIUI 300 WeeksMIUI Lucky FridayMIUI Fan from TurkeyMIUI World TourFan MIUI PhilippinesHappy Valentine's Day2014 ChristmasMIUI 4th AnniversaryAlpaca Mi Bunny Gamer Mi BunnyI Love Mi BunnyMIUI ReviewScroll Of WisdomHumor MasterMIUI FB FollowerMIUI FollowerMIUI Global Forum 2014MIUI Android 4.4 KitKatInbox ZeroUpdates LoverForum Contest LoverStar Of IconsAndroid GuruDie-hard MIUI FanYouth PledgeMost Active MIUIer

 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
27100
Device
Mi 3
MIUI Version
7.6.8
Online time
1854 Hours
Send PM

Mijia Mi Bunny RobotMi WiFi Router MiniMi Selfie StickMi Power BankMi Band 2Mi WiFi RouterMi Bluetooth SpeakerMi T-ShirtUnlock MedalMi HeadphonesMi HomeYeelight Bedside LampMi USB FanMi Plastic In-ear PhonesMi BandMi VRXiaomi 6 LaunchMi KeyMi BoxMi In-Ear HeadphonesMi MIXXiaomi 7th AnniversaryMIUI 2016MIUI 6Awesome!MIUI Devices ContestMIUI 7FlashholicMIUI 2015MIUI 8I Love MIUIFantastic!Mi TVMi 5Mi PadRedmi Note 2Xiaomi Mi 4RedmiMi NoteMi Note ProRedmi 2Mi 4iRedmi Note 3Mi 3Redmi NoteRedmi 3Mi 4c500K Forum MembersXiaomi 5th AnniversarySuper ThursdayFan Of  MIUI AzerbaijanPuzzle Master600K Forum MembersMIUI Happy MedalMIUI Fan From IndonesiaMIUI Fan From BrazilFan Of MIUI Russia1st AnniversaryFan Of MIUI Bangladesh2014 ChristmasFan Of MIUI FranceSuper WednesdayWomen's Day MedalSurge S1Olympics Medal3 Million Forum MembersThanksgiving DayHappy Singles' Day300K Forum MembersMIUI HalloweenFan Of MIUI India5 Million Forum App InstallsMid-Autumn FestivalHappy DiwaliMIUI 4th AnniversarySingapore BirthdayHilal Ramadan Diwali Ataturk MourningMalaysia AnniversaryMIUI 100 Million UsersHappy New YearHappy Valentine's DayMIUI Fan from IndiaMIUI Fan From PhilippinesMIUI Fan from TurkeyMIUI Fan From SingaporeMIUI Fan from MalaysiaFan Of MIUI Ex-Yu MIUI 50 Million UsersSuper SaturdayFan Of MIUI Ukraine3500K Forum MembersSuper SundayMIUI Font LoverSingapore Merlion Medal10 Million Forum PostsMIUI Fan From NepalMIUI World TourFan Of MIUI Greece1 Million Forum MembersSuper MondayMIUI Fan From Myanmar1500K Forum MembersMerry ChristmasUEFA EURO Medal1300K Forum MembersMIUI 2017Rooster Year of 20171400K Forum Members5 Million Forum PostsXiaomi 6th AnniversaryMIUI Lucky FridayMIUI Drawing TalentMIUI Forum App900K Forum MembersSuper Tuesday700K Forum MembersSuper FridayMi Live MedalMIUI 300 WeeksMIUI 6th AnniversaryMIUI 5th AnniversaryPokemon Master Medal800K Forum MembersRocket to FutureGamer Mi BunnyI Love Mi BunnySummer Mi BunnyAlpaca Mi Bunny MIUI Beta TeamMIUI Beta team - IndiaMIUI ReviewMIUI Wallpaper ContestMr. DependableStar Of TechnologyRedmi Quiz MasterMIUI KingInbox ZeroYouth PledgeJuly 19 MyanmarMost Popular Forum UserAndroid ElfMi Story TellerMi Lover MedalMost Active MIUIerMi TalentMIUI G+ FollowerMaster Of TechnologyForum Contest LoverMIUI Twitter FollowerUpdates LoverScroll Of WisdomPioneer of MIUI English Forum Die-hard MIUI FanMIUI FollowerDebate MasterHumor MasterMIUI FB FollowerMIUI Global Forum 2014MIUI Medals CollectorOTA FeedbackTechnology GuruMIUI Android 4.4 KitKatMIUI ExpertStar Of IconsRingtone Star Ringtone TalentMIUI Ice Bucket ChallengeMi Bunny Game Master Android Guru

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

Elite Member

Work for tomorrow

Rank: 6Rank: 6

Credits
15945
Device
Mi 3
MIUI Version
7.6.8
Online time
614 Hours
Send PM

Mi HeadphonesMi Power Bank 10000MAH Mi BoxMijia Story TellerMi WiFi RouterMi Selfie StickMagic CubeMi BandMi HomeMi Power BankMi VRMi In-Ear HeadphonesMi KeyMi Band 2Xiaomi 6 LaunchXiaomi 7th AnniversaryMIUI 7MIUI 2016MarshmallowMIUI 8MIUI 2015FlashholicMIUI Devices ContestMIUI 6Fantastic!I Love MIUIAwesome!Mi 4cMi 4iRedmi 2Xiaomi Mi 4RedmiRedmi Note 2Mi PadMi 3Redmi 1SMi TVMIUI Fan From PhilippinesHappy DiwaliMIUI Fan From Indonesia300K Forum MembersMIUI 5th AnniversaryDiwali Fan Of MIUI India700K Forum MembersPuzzle MasterMIUI Fan from MalaysiaMIUI HalloweenFan Of MIUI Bangladesh800K Forum MembersFan Of  MIUI Azerbaijan2014 ChristmasMIUI Fan from TurkeyThanksgiving Day1st AnniversaryAtaturk MourningHappy Valentine's DayMIUI Fan From Brazil600K Forum MembersXiaomi 5th Anniversary500K Forum MembersMIUI 100 Million UsersHappy New YearHappy Singles' Day1 Million Forum MembersMIUI Monthly TalkRooster Year of 20173 Million Forum App InstallsMIUI Lucky Friday1 Million Forum App InstallsFan Of MIUI RussiaPokemon Master MedalHilal Ramadan MIUI Fan From SingaporeSingapore BirthdayMIUI 2017MIUI 4th AnniversarySuper ThursdaySuper Wednesday3500K Forum MembersFan Of MIUI UkraineSuper SundayMIUI Happy MedalSuper FridaySurge S1Rocket to Future2100K Forum MembersI Love 2016MIUI Fan From NepalMIUI World TourMid-Autumn Festival1700K Forum MembersOlympics MedalMIUI 6th Anniversary900K Forum MembersMerry ChristmasMIUI 50 Million Users1500K Forum MembersMIUI 300 WeeksMIUI Forum AppFan Of MIUI PolandMIUI Fan from India1900K Forum MembersFan Of MIUI Italy1800K Forum MembersI Love Mi BunnyMiPopAlpaca Mi Bunny Summer Mi BunnyGamer Mi BunnyMIUI Device TeamMIUI ReviewMIUI Beta TeamMIUI FollowerMIUI Medals CollectorMost Active MIUIerHumor MasterAndroid GuruStar Of IconsScroll Of WisdomMi Lover MedalStar Of TechnologyTechnology GuruRingtone Star Mi Bunny Game Master App TalentApp TalentMIUI KingMost Popular Forum UserMi Story TellerMaster Of TechnologyMIUI ExpertMi TalentMIUI G+ FollowerYouth PledgeInbox ZeroUpdates LoverOTA FeedbackDie-hard MIUI FanMIUI Android 4.4 KitKatForum Contest LoverMIUI Twitter FollowerDebate MasterAndroid ElfMIUI Global Forum 2014MIUI FB FollowerPioneer of MIUI English Forum

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

Elite Member

MIUI Indonesia

Rank: 6Rank: 6

Credits
8183
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
832
Device
Redmi 1S
MIUI Version
7.5.25
Online time
96 Hours
Send PM

Mi Water PurifierMi Power Bank 10000MAH Mi VR HeadsetMijia VR Play 2Mi Band 2Mi VRXiaomi 6 LaunchMi BandMi Selfie StickMi HomeXiaomi 7th AnniversaryMIUI 7I Love MIUIMIUI Devices ContestMIUI 8MIUI 2016Fantastic!Mi TVRedmi 2Redmi 1SRedmi NoteMi NoteMi 4i2100K Forum MembersPokemon Master MedalMIUI Fan From IndonesiaMIUI Marathon Medal2014 ChristmasMIUI 300 WeeksMIUI Fan From Brazil1 Million Forum MembersMIUI Fan From SingaporeUEFA EURO MedalMIUI 6th Anniversary1400K Forum MembersMid-Autumn FestivalHappy Valentine's DayMIUI 4th AnniversaryMIUI Monthly TalkMIUI Forum App5 Million Forum App InstallsSuper ThursdayI Love 2016Happy Holi MedalRocket to FutureMIUI World TourFan Of MIUI Australia3500K Forum Members3 Million Forum MembersSuper Monday10 Million Forum PostsMIUI 2017Happy New Year1 Million Forum App InstallsRooster Year of 2017Merry ChristmasFan Of MIUI IndiaSurge S1MIUI Lucky FridayI Love Mi BunnyAlpaca Mi Bunny Summer Mi BunnyMiPopMIUI FollowerMIUI Global Forum 2014Die-hard MIUI FanMaster Of TechnologyAndroid ElfUpdates LoverDebate MasterMIUI ExpertScroll Of WisdomStar Of TechnologyMi Story TellerMIUI Medals CollectorMIUI FB FollowerMi Lover MedalMi TalentForum Contest LoverTechnology Guru

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

Credits Management

Quick Reply Top Return to the list