我的 /etc/hosts 没有效果

我的 /etc/hosts 没有效果

我向我的 中添加了大量域/etc/hosts,希望阻止这些网站的传出流量。然而现在我发现我的/etc/hosts没有效果。它旨在充当原始的传出防火墙。

有谁知道为什么这些根本没有效果?

127.0.0.1   a.ns.facebook.com
127.0.0.1   b.ns.facebook.com
127.0.0.1   c.ns.facebook.com 
127.0.0.1   d.ns.facebook.com
127.0.0.1   doubleclick.net
127.0.0.1   edge-star-mini-shv-01-any2.facebook.com
127.0.0.1   edge-star-mini-shv-01-atl3.facebook.com
127.0.0.1   securepubads.g.doubleclick.net
127.0.0.1   twitter.com
127.0.0.1   twimg.com
127.0.0.1   abs.twimg.com
127.0.0.1   pbs.twimg.com
127.0.0.1   apps.facebook.com
127.0.0.1   connect.facebook.net
127.0.0.1   facebook.com
127.0.0.1   fbcdn.com
127.0.0.1   fbsbx.com
127.0.0.1   fbcdn.net
127.0.0.1   graph.facebook.com
127.0.0.1   login.facebook.com
127.0.0.1   s-static.ak.facebook.com
127.0.0.1   static.ak.connect.facebook.com
127.0.0.1   static.ak.fbcdn.net
127.0.0.1   www.connect.facebook.net
127.0.0.1   www.facebook.com
127.0.0.1   www.fbcdn.com
127.0.0.1   www.fbcdn.net
127.0.0.1   www.graph.facebook.com
127.0.0.1   www.login.facebook.com
127.0.0.1   www.s-static.ak.facebook.com
127.0.0.1   www.static.ak.connect.facebook.com
127.0.0.1   www.static.ak.fbcdn.net
127.0.0.1   0-edge-chat.facebook.com
127.0.0.1   1-edge-chat.facebook.com
127.0.0.1   2-edge-chat.facebook.com
127.0.0.1   3-edge-chat.facebook.com
127.0.0.1   4-edge-chat.facebook.com
127.0.0.1   5-edge-chat.facebook.com
127.0.0.1   6-edge-chat.facebook.com
127.0.0.1   alpha-shv-03-ash5.facebook.com
127.0.0.1   alpha-shv-03-atn1.facebook.com
127.0.0.1   alpha-shv-03-lla1.facebook.com
127.0.0.1   alpha-shv-04-prn2.facebook.com
127.0.0.1   alpha-shv-09-frc1.facebook.com
127.0.0.1   alpha.vvv.facebook.com
127.0.0.1   a.ns.facebook.com
127.0.0.1   api.facebook.com
127.0.0.1   atlasalpha-shv-09-frc3.facebook.com
127.0.0.1   atlas.c10r.facebook.com
127.0.0.1   atlasinyour-shv-05-ash3.facebook.com
127.0.0.1   atlas-shv-01-prn2.facebook.com
127.0.0.1   atlas-shv-04-lla1.facebook.com
127.0.0.1   atlas-shv-05-ash3.facebook.com
127.0.0.1   atlas-shv-06-ash2.facebook.com
127.0.0.1   atlas-shv-06-frc1.facebook.com
127.0.0.1   atlas-shv-07-lla1.facebook.com
127.0.0.1   atlas-shv-09-frc3.facebook.com
127.0.0.1   atlas-shv-13-prn1.facebook.com
127.0.0.1   atlas-www-shv-04-prn2.facebook.com
127.0.0.1   atlas-www-shv-07-ash4.facebook.com
127.0.0.1   atlas-www-shv-09-frc1.facebook.com
127.0.0.1   aura-11-01-snc7.facebook.com
127.0.0.1   badge.facebook.com
127.0.0.1   b-api.facebook.com
127.0.0.1   beta-chat-01-05-ash3.facebook.com
127.0.0.1   betanet-shv-03-atn1.facebook.com
127.0.0.1   betanet-shv-03-lla1.facebook.com
127.0.0.1   betanet-shv-04-prn2.facebook.com
127.0.0.1   betanet-shv-09-frc1.facebook.com
127.0.0.1   beta-shv-03-atn1.facebook.com
127.0.0.1   beta-shv-03-lla1.facebook.com
127.0.0.1   beta-shv-04-prn2.facebook.com
127.0.0.1   beta-shv-09-frc1.facebook.com
127.0.0.1   beta.vvv.facebook.com
127.0.0.1   b-graph.facebook.com
127.0.0.1   bidder-shv-05-frc3.facebook.com
127.0.0.1   bidder-shv-10-frc1.facebook.com
127.0.0.1   b.ns.facebook.com
127.0.0.1   channel-proxy-shv-04-frc3.facebook.com
127.0.0.1   channel-proxy-shv-06-ash2.facebook.com
127.0.0.1   channel-proxy-shv-07-ash2.facebook.com
127.0.0.1   channel-proxy-shv-13-prn1.facebook.com
127.0.0.1   channel-proxy-test-shv-07-ash2.facebook.com
127.0.0.1   code.facebook.com
127.0.0.1   connect.facebook.com
127.0.0.1   dev.vvv.facebook.com
127.0.0.1   d.vvv.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-01-ash5.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-03-ash5.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-07-ash4.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-07-frc3.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-09-frc1.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-12-frc1.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-12-frc3.facebook.com
127.0.0.1   edge-atlas-proxyprotocol-shv-13-frc1.facebook.com
127.0.0.1   edge-atlas-shv-01-ams2.facebook.com
127.0.0.1   edge-atlas-shv-01-ams3.facebook.com
127.0.0.1   edge-atlas-shv-01-ash5.facebook.com
127.0.0.1   edge-atlas-shv-01-atl1.facebook.com
127.0.0.1   edge-atlas-shv-01-bru2.facebook.com
127.0.0.1   edge-atlas-shv-01-cai1.facebook.com
127.0.0.1   edge-atlas-shv-01-cdg2.facebook.com
127.0.0.1   edge-atlas-shv-01-dfw1.facebook.com
127.0.0.1   edge-atlas-shv-01-fra3.facebook.com
127.0.0.1   edge-atlas-shv-01-gru1.facebook.com
127.0.0.1   edge-atlas-shv-01-hkg2.facebook.com
127.0.0.1   edge-atlas-shv-01-iad3.facebook.com
127.0.0.1   edge-atlas-shv-01-kul1.facebook.com
127.0.0.1   edge-atlas-shv-01-lax1.facebook.com
127.0.0.1   edge-atlas-shv-01-lga1.facebook.com
127.0.0.1   edge-atlas-shv-01-lhr3.facebook.com
127.0.0.1   edge-atlas-shv-01-mad1.facebook.com
127.0.0.1   edge-atlas-shv-01-mia1.facebook.com
127.0.0.1   edge-atlas-shv-01-mxp1.facebook.com
127.0.0.1   edge-atlas-shv-01-nrt1.facebook.com
127.0.0.1   edge-atlas-shv-01-ord1.facebook.com
127.0.0.1   edge-atlas-shv-01-sea1.facebook.com
127.0.0.1   edge-atlas-shv-01-sin1.facebook.com
127.0.0.1   edge-atlas-shv-01-sjc2.facebook.com
127.0.0.1   edge-atlas-shv-01-syd1.facebook.com
127.0.0.1   edge-atlas-shv-01-vie1.facebook.com
127.0.0.1   edge-atlas-shv-02-cai1.facebook.com
127.0.0.1   edge-atlas-shv-02-hkg2.facebook.com
127.0.0.1   edge-atlas-shv-03-ash5.facebook.com
127.0.0.1   edge-atlas-shv-03-atn1.facebook.com
127.0.0.1   edge-atlas-shv-03-hkg1.facebook.com
127.0.0.1   edge-atlas-shv-03-lla1.facebook.com
127.0.0.1   edge-atlas-shv-03-prn2.facebook.com
127.0.0.1   edge-atlas-shv-03-xdc1.facebook.com
127.0.0.1   edge-atlas-shv-04-hkg1.facebook.com
127.0.0.1   edge-atlas-shv-04-prn2.facebook.com
127.0.0.1   edge-atlas-shv-06-atn1.facebook.com
127.0.0.1   edge-atlas-shv-06-lla1.facebook.com
127.0.0.1   edge-atlas-shv-07-ash4.facebook.com
127.0.0.1   edge-atlas-shv-09-frc1.facebook.com
127.0.0.1   edge-atlas-shv-09-lla1.facebook.com
127.0.0.1   edge-atlas-shv-12-frc1.facebook.com
127.0.0.1   edge-atlas-shv-12-frc3.facebook.com
127.0.0.1   edge-atlas-shv-12-lla1.facebook.com
127.0.0.1   edge-atlas-shv-12-prn1.facebook.com
127.0.0.1   edge-atlas-shv-13-frc1.facebook.com
127.0.0.1   edge-atlas-shv-17-prn1.facebook.com
127.0.0.1   edge-atlas-shv-18-prn1.facebook.com
127.0.0.1   edge-chat.facebook.com
127.0.0.1   edge-liverail-shv-01-ams2.facebook.com
127.0.0.1   edge-liverail-shv-01-ams3.facebook.com
127.0.0.1   edge-liverail-shv-01-ash5.facebook.com
127.0.0.1   edge-liverail-shv-01-atl1.facebook.com
127.0.0.1   edge-liverail-shv-01-bru2.facebook.com
127.0.0.1   edge-liverail-shv-01-cai1.facebook.com
127.0.0.1   edge-liverail-shv-01-cdg2.facebook.com
127.0.0.1   edge-liverail-shv-01-dfw1.facebook.com
127.0.0.1   edge-liverail-shv-01-fra3.facebook.com
127.0.0.1   edge-liverail-shv-01-gru1.facebook.com
127.0.0.1   edge-liverail-shv-01-hkg2.facebook.com
127.0.0.1   edge-liverail-shv-01-iad3.facebook.com
127.0.0.1   edge-liverail-shv-01-kul1.facebook.com
127.0.0.1   edge-liverail-shv-01-lax1.facebook.com
127.0.0.1   edge-liverail-shv-01-lga1.facebook.com
127.0.0.1   edge-liverail-shv-01-lhr3.facebook.com
127.0.0.1   edge-liverail-shv-01-mad1.facebook.com
127.0.0.1   edge-liverail-shv-01-mia1.facebook.com
127.0.0.1   edge-liverail-shv-01-mxp1.facebook.com
127.0.0.1   edge-liverail-shv-01-nrt1.facebook.com
127.0.0.1   edge-liverail-shv-01-ord1.facebook.com
127.0.0.1   edge-liverail-shv-01-sea1.facebook.com
127.0.0.1   edge-liverail-shv-01-sin1.facebook.com
127.0.0.1   edge-liverail-shv-01-sjc2.facebook.com
127.0.0.1   edge-liverail-shv-01-syd1.facebook.com
127.0.0.1   edge-liverail-shv-01-tpe1.facebook.com
127.0.0.1   edge-liverail-shv-01-vie1.facebook.com
127.0.0.1   edge-liverail-shv-02-cai1.facebook.com
127.0.0.1   edge-liverail-shv-02-hkg2.facebook.com
127.0.0.1   edge-liverail-shv-03-ash5.facebook.com
127.0.0.1   edge-liverail-shv-03-atn1.facebook.com
127.0.0.1   edge-liverail-shv-03-hkg1.facebook.com
127.0.0.1   edge-liverail-shv-03-lla1.facebook.com
127.0.0.1   edge-liverail-shv-03-prn2.facebook.com
127.0.0.1   edge-liverail-shv-03-xdc1.facebook.com
127.0.0.1   edge-liverail-shv-04-hkg1.facebook.com
127.0.0.1   edge-liverail-shv-04-prn2.facebook.com
127.0.0.1   edge-liverail-shv-06-atn1.facebook.com
127.0.0.1   edge-liverail-shv-06-lla1.facebook.com
127.0.0.1   edge-liverail-shv-07-ash4.facebook.com
127.0.0.1   edge-liverail-shv-07-frc3.facebook.com
127.0.0.1   edge-liverail-shv-09-frc1.facebook.com
127.0.0.1   edge-liverail-shv-09-lla1.facebook.com
127.0.0.1   edge-liverail-shv-12-frc1.facebook.com
127.0.0.1   edge-liverail-shv-12-frc3.facebook.com
127.0.0.1   edge-liverail-shv-12-lla1.facebook.com
127.0.0.1   edge-liverail-shv-12-prn1.facebook.com
127.0.0.1   edge-liverail-shv-13-frc1.facebook.com
127.0.0.1   edge-liverail-shv-17-prn1.facebook.com
127.0.0.1   edge-liverail-shv-18-prn1.facebook.com
127.0.0.1   edge-mqtt.facebook.com
127.0.0.1   edge-mqtt-shv-01-ams2.facebook.com
127.0.0.1   edge-mqtt-shv-01-ams3.facebook.com
127.0.0.1   edge-mqtt-shv-01-ash5.facebook.com
127.0.0.1   edge-mqtt-shv-01-atl1.facebook.com
127.0.0.1   edge-mqtt-shv-01-bru2.facebook.com
127.0.0.1   edge-mqtt-shv-01-cai1.facebook.com
127.0.0.1   edge-mqtt-shv-01-cdg2.facebook.com
127.0.0.1   edge-mqtt-shv-01-dfw1.facebook.com
127.0.0.1   edge-mqtt-shv-01-fra3.facebook.com
127.0.0.1   edge-mqtt-shv-01-gru1.facebook.com
127.0.0.1   edge-mqtt-shv-01-hkg2.facebook.com
127.0.0.1   edge-mqtt-shv-01-iad3.facebook.com
127.0.0.1   edge-mqtt-shv-01-kul1.facebook.com
127.0.0.1   edge-mqtt-shv-01-lax1.facebook.com
127.0.0.1   edge-mqtt-shv-01-lga1.facebook.com
127.0.0.1   edge-mqtt-shv-01-lhr3.facebook.com
127.0.0.1   edge-mqtt-shv-01-mad1.facebook.com
127.0.0.1   edge-mqtt-shv-01-mia1.facebook.com
127.0.0.1   edge-mqtt-shv-01-mxp1.facebook.com
127.0.0.1   edge-mqtt-shv-01-nrt1.facebook.com
127.0.0.1   edge-mqtt-shv-01-ord1.facebook.com
127.0.0.1   edge-mqtt-shv-01-sea1.facebook.com
127.0.0.1   edge-mqtt-shv-01-sin1.facebook.com
127.0.0.1   edge-mqtt-shv-01-sjc2.facebook.com
127.0.0.1   edge-mqtt-shv-01-syd1.facebook.com
127.0.0.1   edge-mqtt-shv-01-tpe1.facebook.com
127.0.0.1   edge-mqtt-shv-01-vie1.facebook.com
127.0.0.1   edge-mqtt-shv-02-cai1.facebook.com
127.0.0.1   edge-mqtt-shv-02-hkg2.facebook.com
127.0.0.1   edge-mqtt-shv-03-ash5.facebook.com
127.0.0.1   edge-mqtt-shv-03-atn1.facebook.com
127.0.0.1   edge-mqtt-shv-03-hkg1.facebook.com
127.0.0.1   edge-mqtt-shv-03-lla1.facebook.com
127.0.0.1   edge-mqtt-shv-03-prn2.facebook.com
127.0.0.1   edge-mqtt-shv-03-xdc1.facebook.com
127.0.0.1   edge-mqtt-shv-04-hkg1.facebook.com
127.0.0.1   edge-mqtt-shv-04-prn2.facebook.com
127.0.0.1   edge-mqtt-shv-06-atn1.facebook.com
127.0.0.1   edge-mqtt-shv-06-lla1.facebook.com
127.0.0.1   edge-mqtt-shv-07-ash4.facebook.com
127.0.0.1   edge-mqtt-shv-07-frc3.facebook.com
127.0.0.1   edge-mqtt-shv-09-lla1.facebook.com
127.0.0.1   edge-mqtt-shv-12-frc1.facebook.com
127.0.0.1   edge-mqtt-shv-12-frc3.facebook.com
127.0.0.1   edge-mqtt-shv-12-lla1.facebook.com
127.0.0.1   edge-mqtt-shv-12-prn1.facebook.com
127.0.0.1   edge-mqtt-shv-13-frc1.facebook.com
127.0.0.1   edge-mqtt-shv-17-prn1.facebook.com
127.0.0.1   edge-mqtt-shv-18-prn1.facebook.com
127.0.0.1   edgeray-origin-shv-05-prn2.facebook.com
127.0.0.1   edgeray-origin-shv-07-lla1.facebook.com
127.0.0.1   edgeray-origin-shv-09-frc3.facebook.com
127.0.0.1   edgeray-origin-shv-11-frc3.facebook.com
127.0.0.1   edgeray-shv-01-ams2.facebook.com
127.0.0.1   edgeray-shv-01-ams3.facebook.com
127.0.0.1   edgeray-shv-01-atl1.facebook.com
127.0.0.1   edgeray-shv-01-bru2.facebook.com
127.0.0.1   edgeray-shv-01-cdg2.facebook.com
127.0.0.1   edgeray-shv-01-dfw1.facebook.com
127.0.0.1   edgeray-shv-01-fra3.facebook.com
127.0.0.1   edgeray-shv-01-gru1.facebook.com
127.0.0.1   edgeray-shv-01-iad3.facebook.com
127.0.0.1   edgeray-shv-01-kul1.facebook.com
127.0.0.1   edgeray-shv-01-lax1.facebook.com
127.0.0.1   edgeray-shv-01-lga1.facebook.com
127.0.0.1   edgeray-shv-01-lhr3.facebook.com
127.0.0.1   edgeray-shv-01-mad1.facebook.com
127.0.0.1   edgeray-shv-01-mia1.facebook.com
127.0.0.1   edgeray-shv-01-mxp1.facebook.com
127.0.0.1   edgeray-shv-01-ord1.facebook.com
127.0.0.1   edgeray-shv-01-sea1.facebook.com
127.0.0.1   edgeray-shv-01-sin1.facebook.com
127.0.0.1   edgeray-shv-01-sjc2.facebook.com
127.0.0.1   edgeray-shv-01-syd1.facebook.com
127.0.0.1   edgeray-shv-01-vie1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-ams3.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-atl1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-bru2.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-cai1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-cdg2.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-dfw1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-fra3.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-gru1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-iad3.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-kul1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-lax1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-lhr3.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-mad1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-nrt1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-ord1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-sea1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-01-syd1.facebook.com
127.0.0.1   edge-snaptu-http-p1-shv-02-cai1.facebook.com
127.0.0.1   edge-snaptu-tunnel-shv-01-ams3.facebook.com
127.0.0.1   edge-snaptu-tunnel-shv-01-ash5.facebook.com
127.0.0.1   edge-snaptu-tunnel-shv-01-atl1.facebook.com
127.0.0.1   edge-snaptu-tunnel-shv-01-bru2.facebook.com
127.0.0.1   edge-snaptu-tunnel-shv-01-cai1.facebook.com

答案1

检查 /etc/nsswitch.conf 文件中的“hosts”部分。

一定是这样的:hosts: files dns

答案2

在没有像样的应用程序防火墙的情况下,一种方法是:

  1. 识别需要阻止的 IP 范围,例如与不友好的服务器关联的范围。
  2. 添加防火墙规则以阻止所有传出该范围的流量。

这至少有效。

相关内容