我把以下几行放入我的C:\Windows\System32\drivers\etc\hosts
文件中:
127.0.0.1 www.cnn.com
127.0.0.1 cnn.com
127.0.0.1 facebook.com
127.0.0.1 www.facebook.com
127.0.0.1 www.hotnews.ro
127.0.0.1 hotnews.ro
我仍然能够访问这些网站。
我重新启动了计算机、清除了缓存、更换了不同的浏览器,但都不起作用。
我不使用代理。我使用 Windows 7/64 位。
我刷新了我的 DNS:ipconfig /flushdns
当我 ping cnn.com 时,我得到了来自157.166.226.25
我还能做什么?也许有一些程序可以修改主机并与之配合使用。
答案1
要屏蔽网站,您需要列出所有域名,对于像 Facebook 和 YouTube 这样的网站,这是一个非常大的名称和 IP 地址列表。我将在下面复制我用于屏蔽 YouTube 的代码。
Subdomain IP Address
127.0.0.1 host.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 host.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mx.youtube.com
127.0.0.1 216.58.192.206
127.0.0.1 mx.youtube.com
127.0.0.1 216.58.192.238
127.0.0.1 mx.youtube.com
127.0.0.1 172.217.0.14
127.0.0.1 mx.youtube.com
127.0.0.1 172.217.6.14
127.0.0.1 mx.youtube.com
127.0.0.1 172.217.9.46
127.0.0.1 mx.youtube.com
127.0.0.1 216.58.192.174
127.0.0.1 172.217.6.110
127.0.0.1 172.217.4.46
127.0.0.1 172.217.1.46
127.0.0.1 172.217.8.174
127.0.0.1 172.217.8.206
127.0.0.1 216.58.192.142
127.0.0.1 216.58.216.78
127.0.0.1 172.217.4.78
127.0.0.1 216.58.216.238
127.0.0.1 74.125.126.129
127.0.0.1 198.105.244.63
127.0.0.1 198.105.254.63
127.0.0.1 198.105.244.63
127.0.0.1 198.105.254.63
127.0.0.1 mx.youtube.com
127.0.0.1 2607:f8b0:4009:803:0:0:0:200e
127.0.0.1 admin.youtube.com
127.0.0.1 2607:f8b0:4001:c1d:0:0:0:81
127.0.0.1 http.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 http.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mx0.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mx0.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 administration.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 administration.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 development.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 development.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 svn.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 svn.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 id.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 id.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mx1.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mx1.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ads.youtube.com
127.0.0.1 172.217.8.174
127.0.0.1 devsql.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 devsql.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 syslog.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 syslog.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ads.youtube.com
127.0.0.1 2607:f8b0:4001:c1d:0:0:0:66
127.0.0.1 adserver.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 adserver.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 images.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 images.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mysql.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mysql.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 devtest.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 devtest.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 info.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 info.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 news.youtube.com
127.0.0.1 172.217.9.46
127.0.0.1 news.youtube.com
127.0.0.1 216.58.192.174
127.0.0.1 news.youtube.com
127.0.0.1 172.217.6.110
127.0.0.1 news.youtube.com
127.0.0.1 172.217.4.46
127.0.0.1 news.youtube.com
127.0.0.1 172.217.1.46
127.0.0.1 news.youtube.com
127.0.0.1 172.217.8.174
127.0.0.1 news.youtube.com
127.0.0.1 172.217.8.206
127.0.0.1 news.youtube.com
127.0.0.1 216.58.192.142
127.0.0.1 news.youtube.com
127.0.0.1 216.58.216.78
127.0.0.1 news.youtube.com
127.0.0.1 172.217.4.78
127.0.0.1 news.youtube.com
127.0.0.1 216.58.216.238
127.0.0.1 news.youtube.com
127.0.0.1 216.58.192.206
127.0.0.1 news.youtube.com
127.0.0.1 216.58.192.238
127.0.0.1 news.youtube.com
127.0.0.1 172.217.0.14
127.0.0.1 news.youtube.com
127.0.0.1 172.217.6.14
127.0.0.1 alerts.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 alerts.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dhcp.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dhcp.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 test1.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 test1.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 news.youtube.com
127.0.0.1 2607:f8b0:4009:803:0:0:0:200e
127.0.0.1 internal.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 internal.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 noc.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 noc.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 alpha.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 alpha.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 direct.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 direct.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 test2.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 test2.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 internet.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 internet.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ns.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ns.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ap.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ap.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dmz.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dmz.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 testing.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 testing.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 intra.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 intra.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ns0.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ns0.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 apache.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 apache.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dns.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dns.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 upload.youtube.com
127.0.0.1 172.217.8.175
127.0.0.1 upload.youtube.com
127.0.0.1 2607:f8b0:4009:803:0:0:0:200f
127.0.0.1 intranet.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 intranet.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ns1.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ns1.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 app.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 app.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dns0.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dns0.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 vm.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 vm.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ipv6.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ipv6.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ns2.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ns2.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 apps.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 apps.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dns1.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dns1.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 vnc.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 vnc.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 lab.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 lab.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ns3.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ns3.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 appserver.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 appserver.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dns2.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dns2.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ldap.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ldap.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 aptest.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 aptest.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 download.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 download.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 vpn.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 vpn.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 linux.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 linux.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ops.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ops.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 auth.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 auth.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 en.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 en.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 web.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 web.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 local.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 local.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 oracle.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 oracle.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 backup.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 backup.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 erp.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 erp.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 web2test.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 web2test.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 log.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 log.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 owa.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 owa.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 beta.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 beta.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 eshop.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 eshop.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 whois.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 whois.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 pbx.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 pbx.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 blog.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 blog.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 exchange.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 exchange.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 wiki.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 wiki.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 www.youtube.com
127.0.0.1 172.217.8.174
127.0.0.1 www.youtube.com
127.0.0.1 172.217.8.206
127.0.0.1 www.youtube.com
127.0.0.1 216.58.192.142
127.0.0.1 www.youtube.com
127.0.0.1 216.58.216.78
127.0.0.1 www.youtube.com
127.0.0.1 172.217.4.78
127.0.0.1 www.youtube.com
127.0.0.1 216.58.216.238
127.0.0.1 www.youtube.com
127.0.0.1 216.58.192.206
127.0.0.1 www.youtube.com
127.0.0.1 216.58.192.238
127.0.0.1 www.youtube.com
127.0.0.1 172.217.0.14
127.0.0.1 www.youtube.com
127.0.0.1 172.217.6.14
127.0.0.1 www.youtube.com
127.0.0.1 172.217.9.46
127.0.0.1 www.youtube.com
127.0.0.1 216.58.192.174
127.0.0.1 www.youtube.com
127.0.0.1 172.217.6.110
127.0.0.1 www.youtube.com
127.0.0.1 172.217.4.46
127.0.0.1 www.youtube.com
127.0.0.1 172.217.1.46
127.0.0.1 s3.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 s3.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 f5.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 f5.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 www.youtube.com
127.0.0.1 2607:f8b0:4009:803:0:0:0:200e
127.0.0.1 secure.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 secure.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 chat.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 chat.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 fileserver.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 fileserver.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 www2.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 www2.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 server.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 server.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 citrix.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 citrix.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 firewall.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 firewall.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 xml.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 xml.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 main.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 main.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 shop.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 shop.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 cms.youtube.com
127.0.0.1 172.217.8.174
127.0.0.1 forum.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 forum.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 cms.youtube.com
127.0.0.1 2607:f8b0:4001:c1d:0:0:0:66
127.0.0.1 manage.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 manage.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 sip.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 sip.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 corp.youtube.com
127.0.0.1 74.125.126.129
127.0.0.1 corp.youtube.com
127.0.0.1 2607:f8b0:4001:c1d:0:0:0:81
127.0.0.1 mgmt.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mgmt.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 crs.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 crs.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mirror.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mirror.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 sql.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 sql.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 cvs.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 cvs.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 git.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 git.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mobile.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mobile.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 squid.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 squid.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 database.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 database.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 gw.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 gw.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 help.youtube.com
127.0.0.1 172.217.12.100
127.0.0.1 monitor.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 monitor.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ssh.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ssh.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 db.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 db.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 help.youtube.com
127.0.0.1 2607:f8b0:4002:811:0:0:0:2004
127.0.0.1 mssql.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mssql.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 ssl.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 ssl.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 demo.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 demo.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 helpdesk.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 helpdesk.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 mta.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 mta.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 dev.youtube.com
127.0.0.1 198.105.244.63
127.0.0.1 dev.youtube.com
127.0.0.1 198.105.254.63
127.0.0.1 home.youtube.com
127.0.0.1 198.105.244.63
答案2
我不确定这是否能解决你的问题,但我有以下建议:
- 删除文件上可能存在的所有扩展名。
确保你的文件中某处有此行(最好在顶部)
127.0.0.1 localhost
编辑:应该是 localhost 而不是 localhosts (末尾没有“s”)
编辑 2:这是 serverfault 上与 hostfile 相关的信息的相当完整的列表。也许它会有所帮助:https://serverfault.com/questions/452268/hosts-file-ignored-how-to-troubleshoot
答案3
可能的问题,文件损坏。编辑器(记事本)以 .txt 扩展名保存。编辑错误的文件位置。以解决这些问题
- 重命名当前主机文件
然后使用 - 记事本 %SystemRoot%\System32\drivers\etc\hosts
为了获取正确的文件,请从列表中输入一行,保存并检查文件夹以确保没有使用.txt 保存它,然后尝试使用 ping。