我有一台服务器。我希望能够从互联网向这个服务器发送请求(这个工作)并同时阻止从服务器到域的请求。
我想打字
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协议。