
One of the most used and handy features about Firefox is it Ad-blocker extension. As people and companies recklessly graffiti our Internet like a NASCAR Ford, it can be a strain on the eye as well as some pretty long download times. Ad-blocker does a good job but one can also use the hosts file.
Linux, Windows and Macs all have support for a hosts file. A hosts file is a list of resolved DNS addresses (IPs). By substituting the local loopback IP (127.0.0.1) to known spammers addresses the hosts file can be used to filter out said domains.
Luckily for us, we don’t have to enter lists of spammers addresses (there are a few) but that a group of users are already involved doing it. The hosts files project have created a list of known spammer and advertising IP’s to enter into the hosts file. For Linux users, the process is very simple to add these IP’s to the hosts file. Look to the end of the page to the blog for the script. Here is a Linux script that can update the hosts file automagically. The dos2unix application will need to be installed to convert the text properly.
Support the project is encouraged. Put new IP of spammers in the hosts file and upload the hosts files to the project.
Reportedly as I saw on the Ubuntu forums the localhost address should be replace with a null-one as 127.0.0.1 will wait for a timeout. This can be done by doing:
sudo sed -i 's_127.0.0.1_0.0.0.0_g' /etc/hosts
and then edit the file manually to change the line with localhost in it to 127.0.0.1 localhost as this is needed.
Good stuff, Dirk :)
thanks numerodix
“It contains list of IP’s that the source pc disallows information from.”
This isn’t an accurate statement. The host file contains a list of names and their corresponding IP addresses, think DNS. So the host file is a way for your system to resolve names to IP addresses.
The ability to block via the host file is by setting a given name to 127.0.0.1 which is your system so your system will resolve the ad to your system instead of the adserver.
Ahhhhh – nixed.
thanks java
I’ll just stay with AdBlock Plus on my firefox. Banning IP’s might cause some issues… plus I’m perfectly happy with adblock as it is.
The link to the ad-blocker script is broken.
I found another one here.
@ Ikem
Good work Ikem, appreciate the effort. Updated blog.