Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 这是将主机文件修改为不解析的标题_Linux_Unix_Url_Dns_Hosts - Fatal编程技术网

Linux 这是将主机文件修改为不解析的标题

Linux 这是将主机文件修改为不解析的标题,linux,unix,url,dns,hosts,Linux,Unix,Url,Dns,Hosts,我明白,我可以这样说: 127.0.0.1 some.machine.com 进入主机文件将强制some.machine.com在本地解析 如果我不希望某个特定的url根本无法解析,该怎么办?比如说“dev/null”您可以应用相同的逻辑来否定您实际允许解析的URL解析。 例如,我阻止了 www.TechBeamers.com 使用以下条目更新主机文件: 1.1.1.1 www.TechBeamers.com 在更新主机文件之前: Pinging www.TechBeamers.com [xyz

我明白,我可以这样说:

127.0.0.1 some.machine.com

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


如果我不希望某个特定的url根本无法解析,该怎么办?比如说“dev/null”

您可以应用相同的逻辑来否定您实际允许解析的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.
更新主机文件后:

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.

您可以应用相同的逻辑来否定您实际允许解析的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.
更新主机文件后:

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.

要防止访问出站url请求,请使用防火墙iptables。。。没有立即看到这一点。要防止访问出站url请求,请使用防火墙iptables。。。没有立即看到这一点。1.1.1.1 vs 0.0.0?ip地址“0.0.0.0”用于指向默认网关或指定数据包的默认路由。它不能用作普通IP地址。“1.1.1.1”只是一个普通的公共IP地址。1.1.1.1 vs 0.0.0?IP地址“0.0.0.0”用于指向默认网关或指定数据包的默认路由。它不能用作普通IP地址。“1.1.1.1”只是一个普通的公共IP地址。