Firefox does not use /etc/hosts file

I have the following entries in my /etc/hosts file, to block Facebook and meta services. I know that it is not complete and I will be adding additional hostnames over here.

$ cat /etc/hosts
# Standard host addresses
127.0.0.1  localhost
::1        localhost ip6-localhost ip6-loopback
ff02::1    ip6-allnodes
ff02::2    ip6-allrouters
# This host address
127.0.1.1  myCompute
0.0.0.0    facebook.net
0.0.0.0    facebook.com
0.0.0.0    fbcdn.net
$

If I open a new Firefox instance and then try to open facebook homepage using facebook.com it opens up. On certain sites that use Meta marketing and tracking services there also the connection happens. I can close/kill all Firefox instances and start a fresh one and still the same behavior is observed.

This leads to a conclusion that Firefox does not utilize the entries in the /etc/hosts file.

How can we make Firefox use /etc/hosts file ?

I’m afraid I’m a typical forum guy here. I don’t know the answer to your question, and yet I’m responding.

There is another way to accomplish what you want to do. If you use ublock origin, there is a “My filters” tab under configuration that you can edit and add as many blocks as you like.

Hope this helps.

Go to settings and disable DNS-over-HTTPS

Have you tried restarting your own network interface after saving the /etc/hosts file?

The host file is loaded with the OS. Edit’s to the file generally will not take effect until the next reboot. I use hblock on my system and use Zen and Brave/Helium and it works flawlessly for me.

In my experience, reboots aren’t needed, but you do need to restart your network interface. Disabling it and re-enabling it works.

true but old habits die hard. Windows when I last used it one used to have to reboot in order to get the new hosts loaded even disconnecting the network didn’t remove the hosts from memory back then.

:index_pointing_up:

Fair enough.