无论 Windows 10 上的哪个端口,阻止来自某些网站的传入流量的最佳方法是什么?

无论 Windows 10 上的哪个端口,阻止来自某些网站的传入流量的最佳方法是什么?

当我打开网络浏览器并导航到www.cnn.com,它会将所有文本 + 图形下载到我的本地机器中,以供网络浏览器解释/查看。

我怎样才能告诉Windows阻止所有来自www.cnn.com

到目前为止,我尝试执行以下操作,但没有成功:

以管理员身份打开 C:\Windows\System32\drivers\etc\hosts,如下所示:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost

将其更改为如下形式:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
    127.0.0.1       localhost     https://www.cnn.com     http://www.cnn.com
#   ::1             localhost

我重启了 Windows 10 电脑。但当我尝试导航到www.cnn.com在我的网络浏览器中,它仍然能够成功下载所有数据。

我尝试过这样做:

ipconfig /flushdns  

按照建议此链接,但所有 CNN 数据包仍在下载中。

有谁能找到一种方法来防止从特定 IP 地址/URL 下载数据包?

你认为我需要使用防火墙吗小墙

答案1

所有 CNN 数据包仍在下载中。

127.0.0.1       localhost     https://www.cnn.com     http://www.cnn.com

以上内容不正确。您需要执行以下操作:

127.0.0.1       cnn.com     
127.0.0.1       www.cnn.com

请注意,文件本身包含说明:

每个条目应放在单独的一行中。IP 地址应放在第一列,后面跟着相应的主机名。IP 地址和主机名之间应至少有一个空格隔开。

然而,正如 Ramhound 在评论中指出的那样,更改 hosts 文件并不是阻止网站的有效方法

相关内容