ufw 限制端口的流量
ufw是ubunut系统下封装的安全防火墙软件,底层是根据iptables控制
查看ufw 帮助,查看limit用法

下面的示例展示了如何以相同的方式限制 FTP 服务。
sudo ufw limit ftp
UFW 只是一个 Iptables 前端。 UFW 命令背后的规则是来自内核的 iptables 或 Netfilter 规则。上述 UFW 规则是 ssh 的以下 Iptables 规则:
sudo iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 2020 -m state --state NEW -m recent --set --name SSH
sudo iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --update --seconds 30 --hitcount 6 --rttl --name SSH -j DROP

浙公网安备 33010602011771号