Adblocking using /etc/hosts
Adblocking is a non-trivial task, but there are trivial solutions.
Install hosts-gen from http://git.r-36.net/hosts-gen/
% git clone http://git.r-36.net/hosts-gen % cd hosts-gen % sudo make install
Make sure all your custom configuration from your current /etc/hosts is preserved in a file in /etc/hosts.d. The files have to begin with a number, a minus and then the name.
Install the gethostszero script.
# In the above directory. % sudo cp examples/gethostszero /bin % sudo chmod 775 /bin/gethostszero % sudo /bin/gethostszero % sudo hosts-gen
Now the /etc/hosts with the zero hosts is ready and will be used in any further started application.
The gethostszero file can of course be reused to more easier create the /etc/hosts file. A cronjob can be used to update the file and run hosts-gen again.
- Author : Christoph Lohmann < 20h (at) r-36 (dot) net >
They are written in
/etc/hosts file to disable DNS resolution.
Get the script from here : zerohosts.
Include your own
/etc/hosts rules by including a file as an argument
Run the script each time you want to update the lists using a cronjob, or
- Main page : https://yeuxdelibad.net/Logiciel-libre/Code/zerohosts.html
- Author : < thuban (at) yeuxdelibad (dot) net > (feel free to suggest improvements)