Like many developers, I need to eliminate distractions to be able to focus. To do that, I block non-development sites using
/etc/hosts entries, like this:
Today I learned that this doesn’t block sites that use ip6. I have cnn.com in my
/etc/hosts file but it is not blocked in the browser.
To prove this is an ip6 issue I can use
> 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.024 ms > ping6 cnn.com PING6(56=40+8+8 bytes) 2601:240:c503:87e3:fdee:8b0b:dadf:278e --> 2a04:4e42:200::323 16 bytes from 2a04:4e42:200::323, icmp_seq=0 hlim=57 time=9.288 ms
So for ip4 requests cnn.com is pinging localhost and not getting a response, which is what I want. For ip6 addresses cnn.com is hitting an address that is definitely not my machine.
Let’s add another entry to
::1 is the simplification of the ip6 loopback address
Now, does pinging cnn.com with ip6 hit my machine?
> ping6 cnn.com PING6(56=40+8+8 bytes) ::1 --> ::1 16 bytes from ::1, icmp_seq=0 hlim=64 time=0.044 ms