-
使用firewall配置,通过添加富规则(rich rules)来实现
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="8.147.170.200" drop'
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="38.147.170.23" drop'
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="38.147.170.124" drop'
firewall-cmd --reload -
使用iptables配置
- 保存备份iptables规则
iptables-save > /etc/iptables.rules
- 设置规则
iptables -A INPUT -s 8.147.170.200 -j DROP iptables -A INPUT -s 38.147.170.23 -j DROP iptables -A INPUT -s 38.147.170.124 -j DROP
- 将规则写入/etc/iptables.rules
echo "-A INPUT -s 8.147.170.200 -j DROP" >> /etc/iptables.rules echo "-A INPUT -s 38.147.170.23 -j DROP" >> /etc/iptables.rules echo "-A INPUT -s 38.147.170.124 -j DROP" >> /etc/iptables.rules