kar*_*k87 11

拒绝对 ping 请求的响应..添加以下 iptable 规则

iptables -A OUTPUT -p icmp -o eth0 -j ACCEPT          
iptables -A INPUT -p icmp --icmp-type echo-reply -s 0/0 -i eth0 -j ACCEPT     
iptables -A INPUT -p icmp --icmp-type destination-unreachable -s 0/0 -i eth0 -j ACCEPT  
iptables -A INPUT -p icmp --icmp-type time-exceeded -s 0/0 -i eth0 -j ACCEPT       
iptables -A INPUT -p icmp -i eth0 -j DROP       
Run Code Online (Sandbox Code Playgroud)


Car*_*iel 8

我相信iptables -I INPUT -p icmp --icmp-type 8 -j DROP应该可以解决问题。

对于 IPv6,您需要类似ip6tables -I INPUT -p icmpv6 --icmp-type 8 -j DROP.