0

I have recently learnt about 2 different ways of editing the hosts file in Ubuntu for the purpose of blocking webpages and domains tracking my computer (protecting myself from tracking cookies), and I am a little confused here because there are guys who recommend editing the "hosts" file usually located in ~\etc\hosts by using 127.0.0.1 before adding a page address to be blocked and there are guys who recommend using 0.0.0.0 before adding a page address to be blocked.

I have tested both ways in Windows XP and Windows Server 2003 only, and all I can tell so far is that using a template in this form:

127.0.0.1 google-analytics.com
127.0.0.1 ssl.google-analytics.com

is not good at all for my system, and it can slow down even the most common operations.

But I have found that using a template in this form:

0.0.0.0 google-analytics.com
0.0.0.0 ssl.google-analytics.com

seems to be ok as far as system stability is concerned, and even the webpages are loading faster.

My question is whether this method (editing the hosts file) will truly work for blocking webpages and domains tracking my computer in Linux/Ubuntu. I know little about network security so I can't test properly if I am actually more protected now than before after editing this hosts file the way I seen it's meant to be done in the tutorials from the Internet.

So, to conclude, I have these questions:

  1. Which one is better to use before adding the page address to be blocked in 'hosts' file configuration, is it 127.0.0.1 or 0.0.0.0?

  2. How to test if my network security is better after editing the hosts file?

2

You should use 127.0.0.1, the so-called loopback address. Unlike 0.0.0.0, it is a valid IPv4 address.

While it is true that this mitigates some tracking issues, this does not improve security per se.

There are a gazillion sites that track you, and you can't keep up editing your hosts file. To prevent tracking, you'd better use plugins like AdblockPlus and NoScript that auto-update the list of sites to block.

Also note that security is a process, not some setting or configuration.

To strengthen your security, you also need to consider

  • setting up a firewall
  • physical access to your machine
  • lots of other things that would be out-of scope here.
  • Forgot to mention that this is not a big issue for me, I mean it is not like I am running a server, I just want to learn new stuff about network and security hoping this might prove useful someday. I also followed this excellent tutorial and I learnt a lot about system security. Like you said, "To strengthen your security, you also need to consider lots of other things.." And most of them are way out of my league :(. One more thing, I deleted all ubuntu.domain host lines in my Hosts file, is it ok to do so? – Taz D. Sep 21 '14 at 5:32
  • Yes, it seems that 127.0.0.1 is the right call for the loopback address. I was in doubt because in Windows it didn't seem to work so I used 0.0.0.0 instead. I tried the same in Ubuntu but I still noticed after reboot certain "unusual" readings in my browser's status bar like apis/analytics/redirects and similar. Meaning 0.0.0.0 had zero impact. So I am now certain that 127.0.0.1 works in Linux as they promised it would. Thank you for your well-documented answer, and I hope you'll be around next time I'll ask yet another newbie question. Thumbs up Jan and thanks again. – Taz D. Sep 21 '14 at 6:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.