# ad-blocking with your hosts file

## neenee

hi everyone,

while reading a reply in a thread about privoxy, i made a reply

about a different method i use to block ads myself. lovechild

(remember him? from the love-patch. woo!), replied and told

me it might be useful to post my hosts-addition and a small

accompanying text to explain what it is for and how it works.

so here i am, making that post.

what this addition does:

adding known ad-hosts to your hosts file, and listing them with

the ip 127.0.0.1, will make anything wanting to connect to that

ad-host, connect to 127.0.0.1 / localhost instead, which will

prevent the ad-image from being loaded.

in short: the ad will be blocked.

what's nice about this method, is that it does not require any

package to be emerged, or any service which might use up val-

uable resources while it does its thing.

furthermore, it is completely customizable, and ofcourse it's

very easy to do so; just open up your hosts file in any texteditor,

add any new host you come across, save the file and reload

your web-page or whatever you're seeing ads in.

how to make it work:

a) go here and download the hosts file.

b) copy the contents of the downloaded hosts file to your

/etc/hosts, while omitting the first line, which mentions localhost,

and possible others which you configured yourself.

c) save the file and you're done.

append, do not replace your hosts file.

enjoy the web, a lot more ad-free.

*update* thanks Aron for helping me keep this post useful  :Wink: Last edited by neenee on Fri Dec 30, 2005 12:04 am; edited 3 times in total

----------

## TheWart

Thanks a ton!

This is great.

----------

## Jesse

Is this really sane?  It slows my webbrowsing to an utter crawl.

----------

## neenee

it should not slow anything down; ofcourse

looking up hosts might take a fraction of a

second longer, but that's negligable.

if anything, it should speed up browsing

when ads are on a site, since their hosts

no longer have to be contacted and no

ad-images have to be loaded.

----------

## Malakin

 *Quote:*   

> Is this really sane? It slows my webbrowsing to an utter crawl.

 With most browsers this actually speeds things up since it doesn't download the image. Some browsers take a while to timeout while trying to fetch the image though.

I used this technique for many years but ended up moving to Privoxy about 6 months ago. It took a little tweaking to get it working perfectly but now I'm totally happy with it. All sites I frequent are 100% ad free, browsing is faster since I'm not downloading all that garbage and fewer system resources are used since my 10 browser windows don't have all these extra images and flash ads in them. Using the hosts technique I was probably only able to block about 30% of the ads from sites I frequent.

----------

## Squinky86

 *Malakin wrote:*   

> With most browsers this actually speeds things up since it doesn't download the image. Some browsers take a while to timeout while trying to fetch the image though.

 

If you have such a browser, try to get apache going.  If that's out of the question and you really don't want such a thing, point the adhosts to a real server that wouldn't mind giving out a trillion 404 messages.

If even that can't be done, use Mozilla  :Smile: .

----------

## neenee

unless i am mistaken, there is no noticable

delay when a browser calls for an ad which

is in your hosts file pointing to localhost.

hm.. as for pointing to another host instead

of localhost; i doubt there are admins around

which would allow linking to their server like

this.

and linking to something else than localhost

would mean an increase in distance for the

fake ad-host traffic, which would increase

possible delays.

----------

## RedBeard0531

I know that this is an unpopular opinion, but this is a VERY bad idea. Those adds are there for a reason. that page that is giving you free information is trying to make somemoney, and is probrobly barley covering the bandwidth. Imagine if everyone did this. It might mean the end of the free internet. I have no problem blocking popups because they are annoying, but are the ad bars THAT annoying? Im not trying to preach, I just want to pointout some of the consequenses of this.

----------

## GenKiller

 *RedBeard0531 wrote:*   

> I have no problem blocking popups because they are annoying, but are the ad bars THAT annoying? Im not trying to preach, I just want to pointout some of the consequenses of this.

 

In the same way I find those Flash and gif animations ads _extremely_ annoying.  From what I've seen, the ads that are not pay-per-click ads the owner does not get a lot of money from, if any.

I think many people would agree that ad-blocking solutions would be completely unnecessary if there were rules stating no popups, animations, and sound.

----------

## furanku

Hi RedBeard,

with the same logic you could say that we all should not zap around, talk, go to the toilet, talk, etc, during a commercial break in a TV show. Or to read all advertisments in a magazine.

It's legal for a company to try to get my attention to get some "informations" I don't want to know in my head. Therefore it's also legal for me to try to ignore that as good as I can.

I don't want to forbid advertisments, so I don't wanna be forced to see them.

Frank

----------

## Malakin

 *Quote:*   

> unless i am mistaken, there is no noticable
> 
> delay when a browser calls for an ad which
> 
> is in your hosts file pointing to localhost.

 

Netscape 4 had problems with this, it would request the image and wouldn't draw the rest of the page until it got it, it would eventually time out and draw the rest of the page but the delay was large enough to make this approach unfeasable. It's possible this was fixed in the latest versions of 4.x but I don't think it was ever fixed. (netscape 6.x/7.x is a totally different browser and has no such problems)

----------

## Balthasar

I for one think this is great.  I have better things to be doing with my time than trying to decipher where the ads stop and the page begins. 

As for them not getting money, not many seem to anymore, way back when click through was great, I for one took advantage of them in my eariler webmaster days, never did generate much revenue, but the ads nowadays are pointless and normally point to sites that have nothing to do with what your looking for.

Thanks

----------

## Lovechild

I started blocking all those porn banners - I don't mind technology related banners and text only ads, but I don't want to be bothered with porn pops up and flashy banners.. speaking of flash, that dies too.

----------

## Jeedo

also check out http://ssmedia.com/utilities/hosts/ (maybe it would be cool to merge the changes in those files)

----------

## Jeedo

i found out how to merge many host files:

[code]

cat file1 file2 | grep "^127.0.0.1" | sort | uniq >> merged_hosts_file

[ /code]

Do you know of any other files like this one to download and merge into one super-hosts file.

----------

## furanku

 *Jeedo wrote:*   

>  (maybe it would be cool to merge the changes in those files)

 

That's easy to do. First bring the dowloaded files in the same format: Remove the comments in the beginngig and the end with an editor. The file mentioned by you uses whitespaces instead of tabs, the above mentioned uses tabs. Change the tabs in the new one using

```
$ unexpand -a hosts.cfm >hosts.cfm.tabs
```

Merge this and the above mentioned 'hosts' fils with cat, sort them and remove duplicated lines:

```
$ cat hosts hosts.cfm.tabs | sort | uniq >hosts.new
```

Append that file to your /etc/hosts (of course remove before the old ad blocking host list). I know that could be done in a more "pipe-guru-method" in one step, but it works this way. From the approx. 5700 hosts in the new file are just aprox. 840 which weren't in the old file.

Frank

Edit: oops, you've been faster  :Wink: 

----------

## gdoubleu

an alternative to messing with the hosts file if you have mozilla or firebird would be this beauty of an extension i recently came accross, http://adblock.mozdev.org/dev.html.

This development build actually prevents ads/flash/javascript from being downloaded (if you so choose), instead of just not being displayed as in previous versions.

The user defined filters can use either wildcards or regular expressions.

here are a few filters i use that block a considerable number of ads/banners: 

```
/.*[/][Aa][Dd][SsVv]?[/._-].*/

/.*[/]banners?[/].*/
```

and one i use to block most avatars: 

```
*avatar*
```

----------

## Jeedo

Howto merge:

```

cat HOSTS csuchico.edu-hosts my-hosts neenee-hosts ssmedia-hosts | grep "^127" | perl -pe 's/ {7}/\t/g' | perl -pe 's/\r//g' | sort | uniq

```

Urls to host files: 

 *Quote:*   

> 
> 
> http://cos.evilforums.com/~neenee/bin/ad_hosts.tar.gz
> 
> http://ssmedia.com/utilities/hosts/
> ...

 

With this i made a super-hosts file which combined all of the above into one large file.

----------

## spudicus

Two otherplaces you can get host files from are: kazaa lite and spybot,

However, aren't there limits to the size of the hosts file?

Also, you could probably replace the adds with a pic/text of your choice by

pointing to 127.0.0.1/mypic.htm, or something similar

edit: After looking at the site posted above by Jeedo, it seems adding 0.0.0.0 to /etc/hosts instead of 127.0.0.1, will achieve faster results.

The downside is it doesn't work on all OS's (I'm yet to try it on Gentoo) and you can't insert your own personal pic, and we all know how important that is   :Wink: 

----------

## Jeedo

It would be unpolite of me to say i had this great super-hosts file and not provide it, so here goes:

Main site: http://212.30.222.56:81/GNU/Linux-ppc/common/programs/hosts-block/

Mirror: http://157.157.138.42/~jeedo/GNU/Linux-ppc/common/programs/hosts-block/

Also one member of the forums has generusly offered to host this, if you still want to just pick up the tarball and provide the url..

There is a script there do generate the hosts files, that is under the GPL, however some of the hosts files are not freely avalible so they are at most freely avalible. One is GPL though.

----------

## Malakin

 *Quote:*   

> aren't there limits to the size of the hosts file?

 That's a good point, I know windows xp definitely has a limit and it's fairly restrictive so you have to keep the hosts file small. Haven't hit any limits in Linux yet though.

----------

## neenee

i have used the same (17000+ lines) hosts file

with windows without a problem. perhaps your

definition of a small hosts-file differs from mine?

----------

## Malakin

 *neenee wrote:*   

> i have used the same (17000+ lines) hosts file
> 
> with windows without a problem. perhaps your
> 
> definition of a small hosts-file differs from mine?

 

odd, in windows once my hosts file hit a certain point it completely ignored it until I cut down the size and it was certainly nowhere near 17000 lines. Maybe there was an error in it somewhere but I thought I've read other people saying the same thing.

With a hosts file that big I wonder if it could cause any performance issues?

----------

## neenee

i have never experienced any performance

issues myself - not even with a pentium 120

running windows. so i doubt it.

----------

## Lovechild

Biggest problem I've had was etc-update wanting to "update" my hosts file every once in while after a related upgrade and it will take AGES to load the file in before you can reject it.

----------

## neenee

hm.. i am glad i have not run into that (yet?).

----------

## Fluffy`

EDIT AFTER EDIT!

Download first public version:

http://fluffy.homeip.net/blandat.php

----------

## Tazmanian

 *RedBeard0531 wrote:*   

> I know that this is an unpopular opinion, but this is a VERY bad idea. Those adds are there for a reason. that page that is giving you free information is trying to make somemoney, and is probrobly barley covering the bandwidth.

 

It seems to me that the right way to do this is to send the HTTP request for the ad and kill the connection with a TCP RST packet.  This way, the web servers still log the ad hits, but you don't waste bandwidth downloading them, and you don't get flashy junk all over your screen.

I haven't looked, but I highly doubt this is supported by any of the ad-blocking software out there.

Of course, this only works for ads that are inline in the web page you are viewing, and not for ads that come in popups.  Then again, one might be of the opinion that popup ads don't deserve any revenue anyway.   :Wink: 

----------

## Malakin

Since this thread has popped back up again I should mention that the latest version of adblock for Mozilla/Firebird is awesome. I stopped using privoxy and just use adblock now. Adblock now totally removes anything you want it to, it doesn't download it anymore, although you still have the option to download and only hide it if you want.

http://adblock.mozdev.org/

----------

## shiznix

Given the age of this thread, I'm surprised noone has mentioned Squid yet.

Setup a transparent squid http proxy cache & use one of the many squid plugins to block/filter all manner of ads, banners & images.

The upside of this is that there is no chance of delay, cached URLs load instantly for everyone (they're stored on HD), & it's completely configurable at your gateway.

This means you don't have to download/install/configure 3rd party ad blocking programs for each browser on every box connected to your LAN.

Served us well for 3 years. We just don't get any ads  :Smile: 

Regards,

Shiznix

----------

## floam

What would be nice is a way to tell mozilla that if an image is 404 then it should ignore width= and height= in the html, or set both of them to 0. Would make the banners basically invisible. :)

Is it possible to use adblock with Epiphany?

----------

## Tazmanian

 *floam wrote:*   

> What would be nice is a way to tell mozilla that if an image is 404 then it should ignore width= and height= in the html, or set both of them to 0. Would make the banners basically invisible. 

 

The problem with this is that often, web pages are written so that their layout rely on the banners consuming a certain amount of screen space.  Removing that space completely would ruin the layout of such web pages.

----------

## Malakin

 *Quote:*   

> What would be nice is a way to tell mozilla that if an image is 404 then it should ignore width= and height= in the html, or set both of them to 0. Would make the banners basically invisible. :)

 There is an option in adblock "collapse blocked elements" and it does exactly what you want it to, it will collapse images and  iframes, works great. (it's under adblock options in adblock preferences)

I've had collapse turned on since I went back to adblock and haven't had a single website's layout negatively effected by it although it's certainly possible.

----------

## KenTI

this tip is great!! i tried to configure privoxy to do just the simple url filtering like adblock but with no success.. this is extremely easy, you just have to add the url of the adserver to the blacklist

one question, is it possible to use wildcards such as http://*/banners/* like in adblock?

----------

## Malakin

 *Quote:*   

> one question, is it possible to use wildcards such as http://*/banners/* like in adblock?

 If you're referring to the idea of blocking websites with your hosts file then the answer is no, you can only block by server and everything from that server gets blocked. The adblock plugin for firefox is a much better solution imo.

----------

## etnoy

I second that opinion. The time this thread was started, I think thet Firebird was still 0.7 and I don't know if the excellent AdBlock extension was available that time. Firefox being my primary browser, I almost don't see any ads any more  :Smile: 

----------

## KenTI

i use both opera and firefox, and when i was using privoxy (with the default configuration still, i wasn't able to manage tweaking it  :Embarassed:  ) i noticed that privoxy really slowed down browsing

now using opera just with the hosts filter works even faster than firefox, it is a bit complicated to look up for the url of each banner (especially for flash, with adblock you just have to click on the label that appears on the side of the ad)

----------

## Rainmaker

an alternative to this is to use a filtering proxy server

I have one of those on my router, running transparant. This comes in handy, because you don't have to configure every client (copy the host file over)

myh favorite: http://sourceforge.net/projects/middle-man/

----------

## Malakin

I used to use privoxy back before adblock worked as well as it did, there was a noticeable performance penalty and privoxy uses a fair bit of memory just to run.

There is absolutely not benefit to using hosts file blocking over adblock.

The major downside to using hosts file blocking is you have to block the entire server and most ads sit on a server with other legitimate content.

Earlier versions of adblock just stopped the images from being displayed but the current versions are massively imporoved and stop the content from ever being downloaded and there's no performance hit from using it, your pages will actually load faster since they no longer have to download the crap.

http://adblock.mozdev.org/

----------

## omega`

It would be great if there was an adblock clone for Opera. There are some filtering programs for Opera. But I don't like how they work and some only work on Windows.

(Oh and sorry for playing thread necromancer.)

----------

## nat

I'd like to point out another alternative to adblock sites using hostnames. There is a blacklist feature to the dnrd DNS proxy. (from version 2.18 )

Create a list with all the hostnames you'd like to be blocked and save as /etc/dnrd/blacklist no 127.0.0.1 entries in front, just a list with hostnames.

Then point your resolv.conf to 127.0.0.1 and if you have a small network, let all the clients /etc/resolv.conf point to the dnrd host.

Dnrd will answer "host not found" on all listed hostnames instead of 127.0.0.1 so the browser will not even try to connect to localhost.

See https://bugs.gentoo.org/show_bug.cgi?id=77379 for a ebuild for 2.18. (not in portage yet)

----------

## FastTurtle

I'm glad I was able to google for this thread as it provided me enough info to solve an adblock problem in Firefox 1.0.7-r1

What happened was that my adblock list grew to about 200 entries and I started seeing lots of slowdowns and increased CPU usage so it was important to find a solution.

What I did was simply transfered all known advertisers and malware/spyware websites over to the hosts file, while cleaning most entries out of adblock. Now the reason this helped was because of the way adblock works, it places all entries into the about:config file and that's parsed all the time by firefox. Now by using the dual method, my adblock file catches the ads that are sub-domains of websites I visit frequently, while the hosts file speeds things up by silently blocking those websites I want nothing to do with. 

A Word of Warning:

Be very careful what you list in your hosts blocking file as you can unintentionally block good websites. The solution I found that works quite well is to create a plain text file based upon the entries in your adblock file and then add them to your hosts file.

Remember that you can only block the top level domain name; EG: doubleclick, fastclick,burstnet and so on. You can not block yahoo.com/b/ or other sub-domains in your hosts file as it quits parsing at the top level. That's why I use this dual method blocking. Main comes from the /etc/hosts file while adblock catches the variables such as ads/ ads.js and so on.  :Laughing: 

----------

## HeXiLeD

most of the urls posted here with info for the hosts do not open.

can those who have  them in a file post a new url for me to download; or something like that ?

im looking to create a good hosts block file

Thank you

----------

## Arno

Hi,

I use the host file from this site: http://www.everythingisnt.com/hosts.html. It seems to be maintained and is updated from time to time.

Regards.

-- Arno

----------

## neenee

thanks Arno.

i will update my post with a link to that instead,

as my hosts file is no longer downloadable.

----------

## Arny

I'm surprised that nobody's mentioned using squid in combination with the excellent adzapper script. Both are available in portage and very simple to setup. I use this combo on my gateway by redirecting the connection through squid which runs everything through adzapper. This has the advantage of caching pages that I check frequently and automatically replacing ads with an image/text of my choice in such a way to maintains the layout of the page.

Simple, effective, and it probably even saves a minimal amount of bandwidth by not downloading all of those ads. Furthermore it gets updated for me every few months!

----------

## rodoke

Though the site (and file) is very MS-oriented, I use this hosts file.

----------

## HeXiLeD

well right now i have HUGE hosts file and probably with 'dupes' in it. 

is there any and simple cmd line way of doing a checkup and auto remove repetead urls ?

----------

## nanafunk

```
>>> cat bleh.txt 

moo

moo

doo

foo

soo

roo

>>> sort -u bleh.txt 

doo

foo

moo

roo

soo

>>> uniq bleh.txt 

moo

doo

foo

soo

roo

>>> 

```

----------

## HeXiLeD

my current hosts file  here

it has above 75000 hosts

----------

## slick

 :Exclamation:  Be sure always check the (auto-updated) hosts-file for non-127. IPs. Otherwise an attacker can offer an adblock-service and if you use this he can change the IP from the website off your bank to his IP, simulate the bank-website and fish your inputs (= your money)

----------

## Bigun

*bookmarked*

----------

## HeXiLeD

I have noticed one thing when using vmware, and that is that the linux hosts file does not block anything  for vmware OS's.

am i wrong or  its just my setup ?

what  i mean is:

gentoo uses eth0 to connect  to the internet and if i have; lets say http://support.microsoft.com in /etc/hosts,  gentoo cannot connect to it as expected.

now i have vmware using eth0 in a promiscous mode  and if i open the same url in any vmware operating system i get access to  the page. In other words, vmware doesnt read /etc/hosts from linux.

Is there a way of changing this  to make it read the linux hosts?

I have also started a topic here that in some way is kinda related to  this question.

----------

## Bigun

You may have to change the hosts file in the VM.

----------

## HeXiLeD

yes i know. but the point was to use one hosts file only in linux to filter everything.

----------

## Archangel1

I suspect it bypasses the Linux hosts file, so yes, you'd have to change the VM one.

What about if you use a different form of networking? I forget what it's called, but there's one where it has to communicate through the host rather than appearing to be on the network itself. That might turn the trick.

----------

## Bigun

*bookmarked*

----------

## HeXiLeD

My current update is available here with 137.535 entries.

It's a new archive and with wiki page.

----------

## slick

 *Jesse wrote:*   

> Is this really sane?  It slows my webbrowsing to an utter crawl.

 

Install a small Webserver on 127.0.0.1 and point the document root to a empty directory. This is fast, because the browser get a 404 directly.

----------

## Chiitoo

 *KenTI wrote:*   

> i use both opera and firefox, and when i was using privoxy (with the default configuration still, i wasn't able to manage tweaking it  ) i noticed that privoxy really slowed down browsing
> 
> now using opera just with the hosts filter works even faster than firefox, it is a bit complicated to look up for the url of each banner (especially for flash, with adblock you just have to click on the label that appears on the side of the ad)

 

I realize the age of the post I'm quoting (is from 2004), but I thought I'd mention this snippet from the FAQ at the Privoxy website, which helped me and might help someone strolling around here some day!

 *http://www.privoxy.org/faq/trouble.html#GENTOO-RICERS wrote:*   

> 
> 
> 5.23. I compiled Privoxy with Gentoo's portage and it appears to be very slow. Why?
> 
> Probably you unintentionally compiled Privoxy without threading support in which case requests have to be serialized and only one can be served at the same time.
> ...

 

Btw., only now I noticed the #GENTOO-RICERS haha!

Anyways,  I hope this helps!

Works nicely for me.  :]

----------

## user

Or use own dns resolver for blocking ad domains.

1) download http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig;showintro=0

2) save it to /etc/bind/named.adservers.conf

3) strip html header/footer

4) add include directive to /etc/bind/named.conf

          include "/etc/bind/named.adservers.conf";

5) restart your dns resolver

----------

## slick

 *user wrote:*   

> Or use own dns resolver for blocking ad domains.
> 
> 1) download http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig;showintro=0
> 
> ...

 

to add all with 127.0.0.1 to /etc/hosts simply do:

```
lynx --dump "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=bindconfig;showintro=0" | grep "^zone " | cut -d "\"" -f 2 | while read host ; do echo "127.0.0.1 $host" >> /etc/hosts ; done
```

----------

## Sadako

Something else you can do, block via ip address using iptables with ipsets, www.bluetack.co.uk has some extensive lists, not just for blocking adds but potentially hostile or privacy-invading hosts too.

I have that along with dnsmasq with a large hosts file (as discussed in this thread) and privoxy (which blocks most adds for me anyways) on my router.

----------

## HeXiLeD

Updated today with 294278+ entries @ http://nixbits.net/wiki/Hostsfile

----------

## lostinplace

 *RedBeard0531 wrote:*   

> I know that this is an unpopular opinion, but this is a VERY bad idea. Those adds are there for a reason. that page that is giving you free information is trying to make somemoney, and is probrobly barley covering the bandwidth. Imagine if everyone did this. It might mean the end of the free internet. I have no problem blocking popups because they are annoying, but are the ad bars THAT annoying? Im not trying to preach, I just want to pointout some of the consequenses of this.

 

Another way to look at it would be...

I pay for my bandwidth, just like many other users. Particularly rural users who might use cellular service, or in countries with tax on bandwidth.  I also usually find the most ads on sites that are selling things themselves. 

Perhaps the sites that have a sprinkling of discrete ads are not so(or at all) annoying, such as the small add text above my personal gmail account, even when it offers me things that make me blush. However the vast majority of the internet, and the world outside the box for that matter, splash ads on like a five year old finger painting. (I could at this point interject something about the cable co charging me to watch commercials it charges millions of dollars to air, but I wont.) Chances are, if you're using your cell phone to hit such a web site, it cost you more than that entity made. 

Even when I'm not blocking ads, I'm still not looking at them, or clicking them. I am however chewing up my bandwidth, taxing my ISP, and being subliminally predisposed to a fetish to buy Prada, hit the gym, and order a sex doll. And all while simply trying to determine which roses mean friendly apology not secret stalker so my secretary doesn't get me shipped off to some P-C workplace courses. The flowers ultimately costs me $80 from the florist site, and a few hundred from the Prada and the sex doll (can't hit the gym, UPS is coming) that brought said florist's gross from $80 to $80.08.

Drop the ads, put up a donation button, and explain its the button or 10 ads, and you'll probably get at least $1 a click instead of $.01. But don't expect to convince me it's a bad idea to block the 'Bomb building for dummies' ads my garden supply store blasts at me every time I give them $200 for fertilizer for my tomatoes.

----------

## HeXiLeD

 *RedBeard0531 wrote:*   

> I know that this is an unpopular opinion, but this is a VERY bad idea. Those adds are there for a reason. that page that is giving you free information is trying to make somemoney, and is probrobly barley covering the bandwidth. Imagine if everyone did this. It might mean the end of the free Internet. I have no problem blocking popups because they are annoying, but are the ad bars THAT annoying? Im not trying to preach, I just want to pointout some of the consequenses of this.

 

It not an unpopular opinion. It is a subversive statement from someone that has something to win from it. It is also not just about the ads which by being removed or blocked also improve the browser, page and computer performance not to mention the huge security benefit that comes with it. How about cookies? first and 3rd part cookies and the crap that they plant on our computer from a location we don't want to access or have no clue we are downloading from ?

How about java apps that self execute or try to? Are we forgetting spyware? Adware and all the rest of *wares out there we don't want ?

If using a hosts file is a bad idea why is it that any decent firewall and or anti-virus out there supply similar functionality  and where is the difference  because there is one. HOSTs file is free and the other options not really. Is free internet going to end because of proprietary software that blocks ads ?

Lets point all the consequences of blocking sites of this nature with this method versus what we can lose and then weight things.

Claiming that this would end free internet is quite the social engineering mind egg plant to use other peoples lack of knowledge against themselves and making them believe that could actually happen while leading them to drop their protection measures.

Were we being bombed with ads 15 or 25 years ago when it was all very very very free and way more free than now ? Did the internet end back then ?

Whats the next claim ? Open free/source is going to end because there are no 3rd party ads supporting it ? It is the exact same thing.

When someone access IMDB which makes enough money to run and then splashes us with 3rd party ads on their site who pay IMDB to be allowed there; how is it any of this free ? (rhetorical question)

----------

## Ant P.

That's a lot of questions for someone whose last post was 7 years ago and last posted in this topic a decade ago...

Anyway, this is how I do it using BIND; there's no long timeouts because the DNS server says "no" right away:

```
[...]

include "/etc/bind/adblock.conf";

[...]
```

```
[...]

zone "adrevolver.com" { type master; file "pri/empty.zone"; };

zone "adtech.de"      { type master; file "pri/empty.zone"; };

zone "adtechus.com"   { type master; file "pri/empty.zone"; };

zone "atdmt.com"      { type master; file "pri/empty.zone"; };

[...]
```

```
$TTL 1W

@ IN SOA    localhost. root.localhost. ( 1 28800 14400 604800 86400 )

@ IN NS     localhost.
```

----------

## djdunn

if blocking adverts is immoral, than not installing flash which effectively makes flash based adverts immoral too?  

wikipedia doesnt show porn popups and popunders playing music and videos and begging that i go somewhere or porn adds wasting my bandwidth.

if one of the most popular sites on the internet can work without forcing noisy high bandwidth adverts including full video, immoral porn smut, seizure inducing blinking, and filling my screen with 4 popups every time i click on a link, than the future of the free internet is not in peril, but the future of crap internet sites might be.

----------

## anbc

I've decided to switch back to AdBlock in Firefox and remove these localhost blocks.

The hosts file block works well - no slowdown at all, but it's a pain to keep updated and is rather outdated in methodology!Last edited by anbc on Wed Oct 09, 2013 4:29 pm; edited 2 times in total

----------

## 666threesixes666

this is not a sane solution, and should be locked.....  your computer first checks hosts, runs through your 990000000 hosts then goes out to the internet.  then, when it finds a bogus host, it loads your web page on your local computer!  adblock plus was much easier.

----------

## 188562

For my best solution is : dnsmasq + adblock +  pixelserv on tomato based router.

----------

## _______0

 *init_6 wrote:*   

> For my best solution is : dnsmasq + adblock +  pixelserv on tomato based router.

 

what about instructions on how to glue all together??

By the way 0.0.0.0 instead of 127.0.0.1 works too. Apparently using 0.0.0.0 doesn't kill performance.

----------

## _______0

 *Ant P. wrote:*   

> That's a lot of questions for someone whose last post was 7 years ago and last posted in this topic a decade ago...
> 
> Anyway, this is how I do it using BIND; there's no long timeouts because the DNS server says "no" right away:
> 
> ```
> ...

 

Is that all? 

emerge bind

make your changes.

start bind service

that simple?

----------

## 188562

 *_______0 wrote:*   

> what about instructions on how to glue all together??
> 
> By the way 0.0.0.0 instead of 127.0.0.1 works too. Apparently using 0.0.0.0 doesn't kill performance.

 

Set Up Universal Ad Blocking Through Your Router, ALL-U-NEED Ad Blocking v3.9e, Adblock for Tomato Routers, Adblock setup & install package Enough or you need more?

But in general adblock create a file which in turn uses dnsmasq to block the advertisement sources. pixelserv needed to show nothing instead of advertising.

----------

