I am trying to block certain sites from my computer (namely, reddit) in order to get some work done. However, modifying the /etc/hosts file seems to have no effect. I am working under Ubuntu 18.04
Here is the content of my /etc/hosts
127.0.0.1 localhost
127.0.1.1 MY_COMPUTER_NAME
127.0.0.1 reddit.com
127.0.0.1 www.reddit.com
127.0.0.1 np.reddit.com
The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
I would expect this file to block all my connection attempts to www.reddit.com But even after rebooting the computer/browser, my browser can still access reddit normally when I type www.reddit.com in the address bar.
It seems I cannot manage to make the /etc/hosts file work. There is no website that I have managed to block yet (it's not just a reddit thing)
How can I block access to a website from my computer using /etc/hosts ? How can I assert if my /etc/hosts file is working properly ?
When I try to ping the website, here is what happens :
ping -c5 www.reddit.com
PING www.reddit.com (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.034 ms
64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.042 ms
64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.054 ms
64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.043 ms
64 bytes from localhost (127.0.0.1): icmp_seq=5 ttl=64 time=0.054 ms
I am using Firefox, it turns out it was the problem : Firefox does NOT use /etc/hosts by default.