ufw limit proto tcp from any to 1.2.3.4 port 1234,2234
就會對本機 IP 1.2.3.4 的 port 1234,2234 做出 30 秒只能連線六次的限制。
然後不用預設的30/6的話就不用上面那條,直接是 allow 然後手動改 /etc/ufw/before.rules
在
# Don't delete these required lines, otherwise there will be errors *filter :ufw-before-input - [0:0] :ufw-before-output - [0:0] :ufw-before-forward - [0:0] :ufw-not-local - [0:0] # End required lines之後加上
# Limit IP connection(s) # Limit to 10 concurrent connections on port 80 per IP #-A ufw-before-input -p tcp --syn --dport 80 -m connlimit --connlimit-above 300 -j DROP # Limit to 20 connections on port 80 per 2 seconds per IP #-A ufw-before-input -p tcp --dport 80 -i eth1 -m state --state NEW -m recent --set #-A ufw-before-input -p tcp --dport 80 -i eth1 -m state --state NEW -m recent --update --seconds 1 --hitcount 20 -j DROP更機車的設定可以參考這裡
沒有留言:
張貼留言