tschenk wrote:
But if this does not help you also can edit the /etc/hosts file to block several sites
Here is something which was posted to this forum explaining why that is not a good idea:
Use of the hosts file to block ads.
David Charlap MacInTouch Jul 7. 2014
1: It blocks servers, not URLs. This means if a single server is hosting ads and legitimate content that you want to see, you have to take both or block both.
2: There is no wildcarding or domain-scoping, so you need to know all of the hostnames that may be used by an advertiser. Since it is pretty easy for them to rename their servers and change the ad-serving scripts, you're forever playing catch-up. You'll need to keep on adding new hosts to the list (I assume the tool you installed would do this for you.)
3: It blocks all protocols, not just web traffic. So if you want to access that server through other means (maybe ping/traceroute it to figure out who is providing connectivity, you can't.)
4: It blocks servers by redirecting traffic at the null-address (0.0.0.0). This address was historically used as a "don't care" address and many systems, when sending packets to it, will send them as a subnet-broadcast (equivalent to 255.255.255.255). This may put unnecessary traffic on your LAN and might even put a load on your own servers if you have your own local web servers running.
If you decide to stick with the host-file approach (meaning problems 1-3 will remain), I suggest you pick a different IP address than 0.0.0.0 for the blocked hosts. One approach is to pick 127.0.0.1 (localhost), which will result in immediate failures of all requests, if you're not running a local web server. Another would be to pick an unused IP address on your LAN and use that.
But there's another issue. Some web sites load ads via scripts, and those scripts sometimes cause the page to hang for several minutes (network timeouts), if there is no reply from the ad server. A solution to this is to use the IP address of a host on your LAN that is running a web server (possibly even your own computer). Every request will return a 404 error page, which should keep most of the scripts from hanging, since they are getting an actual reply.
If you would like to do this only for web pages and not for all network access, you can set up the same list of hosts using a proxy-auto-config (PAC) file. I wrote an article about this 10 years ago: "Ad blocking on the cheap."
Finally, you might find that some ad-loading scripts hang and timeout even if they get 404 errors. To satisfy them, it should be possible to configure a local web server to serve an actual page (not an error) for every failed URL it receives. It doesn't have to be fancy - it can be a simple HTML page with one line of text. This way, the scripts get no error, the page doesn't hang, and you don't see the ad.
I used to use this approach a long time ago, but I stopped when I realized that tools like AdBlock Plus (running within Firefox and Safari) work even better. They block based on URL filters, not just hostnames, and they are capable of removing advertising scripts from pages, so there isn't even an attempt to load ads.