【问题标题】:This is the title to modify hosts file to not resolve这是修改主机文件以不解析的标题
【发布时间】:2015-10-10 23:16:50
【问题描述】:

我明白这句话的意思是:

127.0.0.1 some.machine.com

进入主机文件将强制 some.machine.com 在本地解析。

如果我不希望某个特定的 url 根本不解析怎么办?说“开发/空”

【问题讨论】:

  • 为了防止访问出站 url 请求是用防火墙 iptables... 没有立即看到这个。

标签: linux unix url dns hosts


【解决方案1】:

您可以应用相同的逻辑来否定您实际允许解析的 URL。 比如我屏蔽了

www.TechBeamers.com

使用以下条目更新主机文件:

1.1.1.1 www.TechBeamers.com

更新主机文件之前:

Pinging www.TechBeamers.com [xyz.xx.yy.xyz] with 32 bytes of data:
Reply from xyz.xx.yy.xyz: bytes=32 time=304ms TTL=50
Reply from xyz.xx.yy.xyz: bytes=32 time=293ms TTL=50

更新主机文件后:

Pinging www.TechBeamers.com [1.1.1.1] with 32 bytes of data:
Request timed out.
Request timed out.

【讨论】:

  • 1.1.1.1 vs 0.0.0.0 ?
  • ip-address "0.0.0.0" 用于指向默认网关或为数据包指定默认路由的情况。它不能用作普通 IP 地址。而“1.1.1.1”只是一个普通的公网IP地址。
猜你喜欢
  • 2012-06-14
  • 2021-03-24
  • 1970-01-01
  • 2012-06-23
  • 1970-01-01
  • 2018-04-21
  • 2023-04-02
  • 2016-01-05
  • 2019-03-04
相关资源
最近更新 更多