User Tools

Site Tools


internet:security:hosts_file

This is an old revision of the document!


Hosts File

The /etc/hosts file contains name resolution info that overrides DNS. You might add entries in the /etc/hosts file that is not in DNS.

Here we use the /etc/hosts file as an ad filter.

Configuring

winhelp2002

Here is a public hosts file that we will use as a starting point:

wget http://www.mvps.org/winhelp2002/hosts.txt

To use just this one list of ad servers, remove all lines before # [Start of entries generated by MVPS HOSTS] and append the rest to your own /etc/hosts file…or continue on to add the second list.

yoyo.org

Here we download another list and concatenate it with the previously downloaded list of adservers and your existing /etc/hosts file:

wget -O hosts "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext"
sed -i 's/127.0.0.1/0.0.0.0/g' hosts
cat hosts >> /etc/hosts.txt

vim hosts.txt

:%s/^Mg :!: To strip out the DOS carriage returns, enter Ctrl-v Ctrl-m to input the ^M. cat hosts.txt » /etc/hosts ===== SME Server ===== http://wiki.contribs.org/Block_Adware_Sites Here we use both adserver lists together: <file> wget http://www.mvps.org/winhelp2002/hosts.txt mv hosts.txt /etc/e-smith/templates/etc/hosts/30hosts vim /etc/e-smith/templates/etc/hosts/30hosts </file> Remove all lines before “#start of lines added by WinHelp2002” and save. Now we add the contents of another list: <file> wget -O hosts “http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&startdate[day]=&startdate[month]=&startdate[year]=&mimetype=plaintext” cat hosts » /etc/e-smith/templates/etc/hosts/30hosts expand-template /etc/hosts </file>

internet/security/hosts_file.1451194872.txt.gz · Last modified: 2015/12/26 22:41 by gcooper