首页 » 人工智能 » iptables之禁ping和ddos向外发包

iptables之禁ping和ddos向外发包

龙城装饰工程通讯 2024-12-27 0

扫一扫用手机浏览

文章目录 [+]

紧张讲2个基本的实际运用,紧张涉及到禁ping(ipv4)以及禁止udp,即禁止有黑客利用做事器向外发包ddos攻击方面的内容。

一、如果没有iptables禁止ping

iptables之禁ping和ddos向外发包 iptables之禁ping和ddos向外发包 人工智能

echo 1 > /proc/sys/net/ipv4/icmp_echo_igore_all #开启echo 0 > /proc/sys/net/ipv4/icmp_echo_igore_all #关闭

二、利用iptables规则禁ping

iptables之禁ping和ddos向外发包 iptables之禁ping和ddos向外发包 人工智能
(图片来自网络侵删)

iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP

三、利用iptables规则,禁止做事器向外发包,防止DDOS向外攻击

iptables -I OUTPUT -p udp --dport 53 -d 8.8.8.8 -j ACCEPT #许可UDP做事IPiptables -A OUTPUT -p udp -j DROP #禁止udp做事

上述53端口和8888是DNS做事必须有的,如果不清楚本机的DNS设置,可实行以下命令得到IP:

cat /etc/resolv.conf

相关文章