why /etc/hosts don't effect to my firefox on Ubuntu 10.04?

5

I tried to block some hosts to load from them ads and scripts. for example in /etc/hosts:

127.0.0.1 web-visor.com
0.0.0.0   c1.web-visor.com

Why after editing and saving the file, firefox (after restart) still load this sites (not from cache of course)?

My /etc/host.conf seems to search previously in hosts file

order hosts,bind
multi on

What's wrong?

Daniel

Posted 2010-11-20T17:02:02.043

Reputation:

Answers

2

host.conf is obsolete, look in nsswitch.conf .

Tobu

Posted 2010-11-20T17:02:02.043

Reputation: 2 584

Do you know how to use it instead of /etc/hosts? Because the manual doesn't seem to give even a little hint, and I couldn't find an examples about that. /etc/hosts can't supposed to be obsolete until the new one can execute it's functions. From manual I am doubt that it is. – Hi-Angel – 2014-09-30T13:56:28.873

1/etc/host.conf is obsolete, /etc/hosts isn't. nsswitch.conf decides whether and how /etc/hosts is used. – Tobu – 2014-10-01T13:28:06.833

1

put www version of domain also in /etc/hosts.

127.0.0.1 web-visor.com
127.0.0.1 www.web-visor.com

It is because firefox tries to resolve www.web-visor.com as well.

Rijul Sudhir

Posted 2010-11-20T17:02:02.043

Reputation: 111

This did not work for me. – JayRizzo – 2018-05-14T06:06:46.900

1

# =============================================================================
# URL: https://ss64.com/osx/fc.html 
#      The ad at the bottom
# Computer: MacBook Pro OSX 10.13.4
# Browser: Firefox Quantum 59.0.2 (64-bit)
# Problem: /etc/hosts was not being observed by browser
# =============================================================================

So, I know this post is way old but, for me in "Firefox Quantum" not being able to use the host file was driving me NUTS, I'm way to OCD for this... lol, so before I canned Firefox, I Ran/Fell down the rabbit hole

After scouring thru the web looking for answers, reading blogs forums and potential answers everywhere, yet, still getting nowhere:

I had tried:

  1. Reformatting my /etc/hosts file

    • Just incase this contained hidden characters
    • Also, Tested host file formatting using:
      • 1 space
      • 4 spaces
      • 1 tab
      • This made no difference to Chrome, Safari or Firefox
  2. Also, Tried modifying Firefox's about:config Changed

    • browser.fixup.dns_first_for_single_words to True
    • network.dns.disablePrefetch to True
    • network.dns.offline-localhost to False
    • network.dnsCacheEntries to 0 (ZERO)
    • network.dnsCacheExpiration to 0 (ZERO)
    • network.dnsCacheExpirationGracePeriod to 0 (ZERO)

and to no avail (I reverted all the above back to default)

# =============================================================================
# FINALLY, I found that you have to change 3 things
# =============================================================================
  • Navigate to 3 bars > Preferences > General > Scroll to the end > Network Proxy > settings
  • Configure Proxies to Access the Internet: *CHANGE* Auto-detect proxy settings for this network

    • I was using Use System Proxy Settings

      1. I also found that is you change tracking in preferences & config this hides the box's too in Firefox
  • Navigate to 3 bars > Preferences > Privacy & Security > Tracking Protection >Always& "Do Not Track" >Always AND YOU ALSO have to set this in the browserabout:config`
  • privacy.trackingprotection.enabled To True

This hides the error'd out ad's instead of showing the iframe with the blocked content.

I'm so happy right now that I got this workin' I hope this helps someone!

JayRizzo

Posted 2010-11-20T17:02:02.043

Reputation: 194

1

Does your Firefox use proxy? /etc/hosts SHOULD effect your Firefox (I tested it). What is the result of pinging those addresses?

karatedog

Posted 2010-11-20T17:02:02.043

Reputation: 809

1How did you test this? In my experience, a proxy overrides /etc/hosts. – SabreWolfy – 2013-02-28T11:16:05.033

If you turn on the feature that intranet addresses should not use proxy, then /etc/hosts should no be overridden by the proxy (technically it is not an override, the domain you try to reach will be sent to the proxy, and the proxy will re-resolve it by its own DNS which will return a correct IP). – karatedog – 2013-02-28T15:13:21.550