Running LinuxMint 16 (which appears to be Ubuntu 13.10 "Saucy Salamander" under the hood) on 3.11.0-12-generic (x86_64). For what it's worth, this is on a MacBook Air.
I desire to use the /etc/hosts file like I always have - to provide unroutable IPs as the defacto truth for domains that I dislike. For the most part this is the MVPS hosts file, with a few slight changes:
1. Ensured it has Linux line endings
2. Ensured that the default info for my system was added back in (copied from /etc/hosts.orig, which used to be /etc/hosts)
3. Removed the MVPS defaults for localhost, etc.
4. Set all "to be blocked" IPs to "255.0.0.0".
To test functionality, I added "255.0.0.0 msn.com" to the list. Then I tried to browse to msn.com. It worked, and the msn.com page loaded. This computer was freshly built and this was literally the browser's first time running, so I kinda doubt that the answer was cached somehow. I did reboot between editing /etc/hosts and kicking off the browser.
Googling came up with these steps (I did each of these, checking functionality inbetween[no joy]):
Check the /etc/nsswitch.conf file and make sure that the order makes sense:
hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
Check the /etc/NetworkManager/NetworkManager.conf file and comment out the line that reads: "dns=dnsmasq"
None of this worked.
So I messed around and found that there is some GUI thing in Mint that lets you block domains "mintNanny", it is called. I was greatly saddened to find that all this app seems to do is add an entry into /etc/hosts. But get this - when mintNanny adds something to /etc/hosts, the DOMAIN ACTUALLY GETS BLOCKED. Further testing revealed that the only difference is a comment after the domain - Mint will use /etc/hosts in the way I wanted ONLY IF the string "# blocked by mintNanny" occurs after each declaration on the same line.
So this works:
255.0.0.0 msn.com # blocked by mintNanny
but this doesn't work:
255.0.0.0 msn.com
Also, I'm not an expert on /etc/hosts, but using "www.msn.com" doesn't help any in this case.
Manually making that entry works as well, you don't have to use the GUI, so yay. Only NOT YAY, because after working gawk awesomeness to add "# blocked by mintNanny" to every single domain in /etc/hosts, the mintNanny application coughed and died, failed open and allowed everything. (perhaps this is a useful thing to know, but whatever) I checked thoroughly, and found that mintNanny simply can't handle that many entries. Grrrr.
Also, I ran tcpdump during this testing - the system is indeed sending out dns requests, so I'm pretty sure it's not a caching issue.
I am not really interested in a quick-fix like adblock for firefox or similar - I want my computer as a whole (not just the browser) to fail to find tracking/ad/whatever websites. Any idea what else I can do?