Dns

我的 /etc/hosts 沒有效果

  • February 17, 2021

我在我的 . 中添加了大量域/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. 辨識需要阻止的 IP 範圍,例如與不友好伺服器關聯的範圍。
  2. 添加防火牆規則以阻止所有傳出流量到該範圍。

這至少有效。

檢查 /etc/nsswitch.conf 文件中的“主機”部分。

它必須是這樣的:hosts: files dns

引用自:https://unix.stackexchange.com/questions/631957