On macOS Big Sur I added the settings below to my /etc/hosts
my ISP has IPV6 support so normally browsing to major sites that support IPV6 should probably happen on IPV6.
127.0.0.1 cnn.com
::1 cnn.com
In a terminal window I can see that ping is using the /etc/host
ping cnn.com
PING cnn.com (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.036 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.118 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.120 ms
--- cnn.com ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.036/0.091/0.120/0.039 ms
and ipv6
ping6 cnn.com
PING6(56=40+8+8 bytes) ::1 --> ::1
16 bytes from ::1, icmp_seq=0 hlim=64 time=0.061 ms
16 bytes from ::1, icmp_seq=1 hlim=64 time=0.157 ms
16 bytes from ::1, icmp_seq=2 hlim=64 time=0.156 ms
16 bytes from ::1, icmp_seq=3 hlim=64 time=0.159 ms
16 bytes from ::1, icmp_seq=4 hlim=64 time=0.136 ms
--- cnn.com ping6 statistics ---
5 packets transmitted, 5 packets received, 0.0% packet loss
round-trip min/avg/max/std-dev = 0.061/0.134/0.159/0.037 ms
However from the browser cnn.com still loads up in Firefox, Chrome, and Safari. I tried all the following suggestion form this site and others on the internet but still cnn.com still shown up in the browsers.
- Shut down all programs and restart the machine
- Flush the DNS cache using
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
- checked that firefox was not using DNS over HTTP
- Flushed the DNS cache in chrome using
chrome://net-internals
How do I block cnn.com on macOS Big Sur using /etc/hosts for the whole system?
127.0.0.1 cnn.com
,::1 cnn.com
,127.0.0.1 www.cnn.com
and::1 www.cnn.com
to/etc/hosts
and then opened Safari, Google Chrome and Firefox and tried to get tohttps://cnn.com
andhttps://www.cnn.com
. I could not get to those URLs, however I could get to other sites. So, I cannot replicate your issue as thehosts
file is doing what it's supposed to do on my system.0.0.0.0
or127.0.0.1
to "block"?0.0.0.0
will fail to send any packets due to a "socket not connected" while127.0.0.1
will send packets to localhost. Why add traffic?