LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-17-2014, 02:04 PM   #1
standard_output
LQ Newbie
 
Registered: Apr 2012
Posts: 16

Rep: Reputation: Disabled
Failed to Short-Circuit Name Resolution Process :-(


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?
 
Old 09-17-2014, 02:47 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,226

Rep: Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295Reputation: 1295
255.0.0.0 is a weird address to use since it looks like a broadcast address. The mintNanny doc claims that it uses 0.0.0.0 which is a well-defined non-routable address.
 
Old 09-17-2014, 05:12 PM   #3
standard_output
LQ Newbie
 
Registered: Apr 2012
Posts: 16

Original Poster
Rep: Reputation: Disabled
Not quite...

Something like 192.168.1.255 would be a broadcast address. Either way, I've tried it setting them to 0.0.0.0, as well as 127.0.0.1, and 255.255.255.255. No effect.
 
Old 09-17-2014, 06:15 PM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Yeah, right. If there's anything bloated and ineffective it's that hosts file. Deities know why people keep promoting it... Using /etc/hosts for redirecting lookups like that is a crude, past millennium way of dealing with things. To be more specific it won't help with or can't parse Javascript fun or do path-based filtering, update incrementally, block ad-tracking cookies, block in-page ads residing in a path on the same server you visit, block ads from a hostname of which the domainname is the same as the server you visit, block ads presented through Javascript or Flash, block ads by host or path substring match, block only web bugs, set session-only cookies for a range of sites, selectively block popups, refresh-tags and redirects, keep images with specific sizes from displaying or block visiting domains based on content. On top of that you'll have a hosts file filled with sites you might not even visit, no insight in how filters get added and nobody to vouch for its contents other than this one person.

For effective, usable and efficient distro and browser-agnostic filtering you can't beat a filtering proxy. Disagree? See if your hosts file can "protect" you against "modern" tricks (and I mean this decade, not the past millennium): https://www.linuxquestions.org/quest...9/#post3585760 (BTW don't need to look: it can't.)
 
  


Reply

Tags
dont_use_a_hosts_file


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
IN CIRCUIT EMULATOR vs IN CIRCUIT DEBUGGER elico Linux - Embedded & Single-board computer 2 05-22-2012 01:20 PM
rsh failed : poll: protocol failure in circuit setup fender_gr Red Hat 1 04-02-2008 06:16 AM
Read process memory (short novel inside) nullmind Programming 5 03-08-2008 09:59 PM
Failed to start the display server several times in a short time 0x5A2B Linux - Newbie 1 05-23-2006 12:17 AM
Red Hat X - Failed to start the display server several times in a short time in.. mjkchi Linux - General 0 12-13-2003 12:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:27 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration