Click here to Skip to main content
15,860,861 members
Articles / Programming Languages / C#

Browse Internet Faster and Save Power using a Smart HOSTS File

Rate me:
Please Sign up or sign in to vote.
5.00/5 (12 votes)
29 Dec 2011CPOL4 min read 63.3K   17   13
How to browse the internet faster and save power using a smart HOSTS file

The internet is full of flash ads nowadays that make page loads slower, render slower and consume more CPU, thus power. If you can browse without having any flash ads or in fact any ads loaded and without any of the tracking scripts – you can browse much faster, scroll through pages much smoother and have more hours from your battery. Nowadays, most websites use scripts from various analytics sites that track your browsing habits, use IFRAME to load tracking and social networking widgets. All of these add considerable delay to page loading and make browser consume more CPU and bandwidth. If you can turn all of them off, browsing the internet feels a lot smoother, faster and you get more work hours while running on battery.

Moreover, you don’t get distracted by the flashy ads and save your children and young family members from looking at foul things.

If we could get 10% of the total internet users (2bn as of Jan 2011) to save 10% CPU, power and bandwidth while browsing everyday, we could save mega watts of power everyday throughout the world!

Using this solution, you can prevent ads and tracking scripts, prevent malicious and porn websites.

How Bad Is It?

Let’s take an example on a popular website. The red boxes are Flash Ads (read power suckers).

image

Once we disable all ads and tracking scripts, here’s how it looks:

image

Statistics:

 BeforeAfter
Total Requests111100
Total Download Size1.2 MB0.98 MB
Page load time4.34s3.64

Not just during page loading, while you are on the page, doing nothing, just reading, the browser continuously consumes CPU.

Before:

image

After:

image

Before disabling the ads and tracking scripts, CPU is always around 20-25%. After disabling, it is around 8-10%. The more the CPU works, the more power it consumes. If you are running on battery, you can get at least 20% more time from your battery. If you have many tabs open all the time, you can save more.

Here’s How to Save CPU, Bandwidth and Power

Go to this website and download the HOSTS file:

Follow the instruction to put the HOSTS file in your C:\Windows\System32\Drivers\etc folder.

Now go to Start Menu, type Notepad but do not hit enter. Right click on Notepad and select Run As Administrator.

image

Go to File menu and click Open.

Copy and paste this into the File Name and click OK.

c:\windows\system32\drivers\etc\HOSTS

image

Now go to Edit menu and select Replace. Put 127.0.0.1 in Find box and put 255.255.255.0 in Replace box. Click Replace All.

image

Once done, you need to type back 127.0.0.1 for the first entry localhost.

image

Remember, localhost cannot be 255.255.255.0.

When you have done this correctly, it will look like this:

image

Save the file and exit Notepad.

Then go to Start menu and type: services.msc

From the service list, double click on “DNS Client”.

image

First click “Stop” to stop the service.

Then, from the Startup Type dropdown, select Disabled.

Click OK.

image

Close all your browsers and reopen them. I highly recommend restarting your PC.

You are ready to browse faster, smarter, cheaper!

I also highly recommend everyone to use OpenDNS. You can save yourself from getting into malicious sites and being ripped off your bank balance, property, spouse and children. Just go to www.opendns.com and follow the instruction. It is the best thing that happened on the internet after Wikipedia!

How Does the HOSTS File Trick Work?

Here’s how internet works. You type www.something.com and it goes and finds out what is the IP address for this domain. First Windows checks a file called HOSTS. If it is not defined there, it will ask the DNS Server configured for your network to give it the IP for the domain so that it can connect to the webserver. If you put fake IP in the HOSTS file, Windows will hand over fake IP to the browser and browser will connect to the fake IP. Thus by putting an invalid IP, we prevent the browser or any application running on your PC from reaching the ads, tracker, malicious and porn websites.

Don’t forget to share this with your friends and families!

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect BT, UK (ex British Telecom)
United Kingdom United Kingdom

Comments and Discussions

 
GeneralMy vote of 1 Pin
Maximc23-May-13 12:48
Maximc23-May-13 12:48 
GeneralMy vote of 5 Pin
Belial0926-Jul-12 21:22
Belial0926-Jul-12 21:22 
QuestionReplace 127.0.0.1 to 255.255.255.0 ? Pin
Michael Freidgeim14-Jan-12 12:51
Michael Freidgeim14-Jan-12 12:51 
QuestionCan't find the updated Hosts file Pin
Bruce Fulford4-Jan-12 9:24
Bruce Fulford4-Jan-12 9:24 
AnswerRe: Can't find the updated Hosts file Pin
Omar Al Zabir4-Jan-12 10:21
Omar Al Zabir4-Jan-12 10:21 
QuestionSpybot Entered Entries Pin
xiecsuk2-Jan-12 22:10
xiecsuk2-Jan-12 22:10 
GeneralMy vote of 5 Pin
fredatcodeproject31-Dec-11 15:28
professionalfredatcodeproject31-Dec-11 15:28 
General2nd alternative Pin
sx20082-Jan-12 8:07
sx20082-Jan-12 8:07 
GeneralRe: 2nd alternative Pin
fredatcodeproject3-Jan-12 0:34
professionalfredatcodeproject3-Jan-12 0:34 
GeneralMy vote of 5 Pin
HamidYaseen30-Dec-11 20:34
professionalHamidYaseen30-Dec-11 20:34 
GeneralMy vote of 5 Pin
Sridhar Patnayak29-Dec-11 19:31
professionalSridhar Patnayak29-Dec-11 19:31 
GeneralMy Vote of 5 Pin
RaviRanjanKr29-Dec-11 10:17
professionalRaviRanjanKr29-Dec-11 10:17 
GeneralMy vote of 5 Pin
JackDingler29-Dec-11 9:29
JackDingler29-Dec-11 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.