I used to block domains on Windows using the hosts file like the following:

127.0.0.1 www.cnn.com

However, now it is not working and the domains are resolving.

$ nslookup www.cnn.com
Non-authoritative answer:
Server:  cdns01.comcast.net
Address:  2001:558:feed::1

Name:    turner-tls.map.fastly.net
Addresses:  2a04:4e42:1c::323
          151.101.117.67
Aliases:  www.cnn.com

>ping www.cnn.com

Pinging turner-tls.map.fastly.net [2a04:4e42:1c::323] with 32 bytes of data:
Reply from 2a04:4e42:1c::323: time=16ms

I don't know what changed. How can I continue to block domains using the hosts file on Windows? Why did Windows suddenly stop using the hosts file?

>icacls \Windows\system32\drivers\etc\hosts
\Windows\system32\drivers\etc\hosts NT AUTHORITY\SYSTEM:(I)(F)
                                    BUILTIN\Administrators:(I)(F)
                                    BUILTIN\Users:(I)(RX)
                                    APPLICATION PACKAGE AUTHORITY\ALL APPLICATION PACKAGES:(I)(RX)

Successfully processed 1 files; Failed processing 0 files

C:\Users\Chloe>ipconfig /flushdns

Windows IP Configuration

Successfully flushed the DNS Resolver Cache.

C:\Users\Chloe>nslookup www.cnn.com
Server:  cdns01.comcast.net
Address:  2001:558:feed::1

Non-authoritative answer:
Name:    turner-tls.map.fastly.net
Addresses:  2a04:4e42:1c::323
          151.101.117.67
Aliases:  www.cnn.com

Windows 8.1

up vote 0 down vote accepted

@DavidPostill Yes, that was exactly it! ping is not finding the domains.

https://serverfault.com/a/698060/123651

nslookup does NOT use hosts file but DNS.

Try using ping instead and it will return the IP provided in your hosts file.

$ ping www.cnn.com

Pinging www.cnn.com [127.0.0.1] with 32 bytes of data:
Reply from 127.0.0.1: bytes=32 time<1ms TTL=128

It is very strange that the domains were resolved to begin with, as the entries in the hosts file have existed for months.

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.