编辑如下文件
vi /etc/ufw/before.rules
在# End required lines和# allow all on loopback之间,加上如下内容:
# Block spammers
-A ufw-before-input -s 101.89.0.0/16 -j DROP
-A ufw-before-input -s 61.241.0.0/16 -j DROP
如下文所示:
# 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
# Block spammers
-A ufw-before-input -s 101.89.0.0/16 -j DROP
-A ufw-before-input -s 61.241.0.0/16 -j DROP
# allow all on loopback
-A ufw-before-input -i lo -j ACCEPT
-A ufw-before-output -o lo -j ACCEPT
未经允许,请勿转载!