Dns 如何阻止outgoin域请求

Dns 如何阻止outgoin域请求,dns,ping,hosts,Dns,Ping,Hosts,我有一台服务器。我想使从internet向该服务器发送请求成为可能,这样可以同时阻止从服务器到域的请求 我想打字 ping google.com 在服务器上,什么也看不到 现在我明白了 ping google.com PING google.com (216.58.205.46) 56(84) bytes of data. 64 bytes from mil04s24-in-f46.1e100.net (216.58.205.46): icmp_seq=1 ttl=54 time=36.3 m

我有一台服务器。我想使从internet向该服务器发送请求成为可能,这样可以同时阻止从服务器到域的请求

我想打字

ping google.com
在服务器上,什么也看不到

现在我明白了

ping google.com
PING google.com (216.58.205.46) 56(84) bytes of data.
64 bytes from mil04s24-in-f46.1e100.net (216.58.205.46): icmp_seq=1 ttl=54 time=36.3 ms
64 bytes from mil04s24-in-f46.1e100.net (216.58.205.46): icmp_seq=2 ttl=54 time=63.7 ms

您可以使用iptables防火墙规则阻止任何tcp/udp传出流量

例如,您可以使用以下防火墙规则阻止来自端口5050的任何传出TCP流量-

iptables -A OUTPUT -p tcp --dport 4050 -j DROP
iptables save
与阻止ping请求类似,您可以阻止任何出站流量的ICMP协议