friewalld 防火墙

systemctl start firewalld.service

firewall-cmd --permanent --add-port=7000/udp
firewall-cmd --permanent --add-port=7000/tcp

#取消放行的80端口

firewall-cmd --zone=public --remove-port=80/tcp --permanent

#查看当前防火墙规则

firewall-cmd --list-all

#查看默认区域
firewall-cmd --get-default-zone


#删除富规则
firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="139.162.206.94" drop'
firewall-cmd --reload

# drop 一个特定IP
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="139.162.206.94" drop'
firewall-cmd --reload

#添加富规则

firewall-cmd --zone=public --add-rich-rule='rule family="ipv4" source address="192.168.2.138" port protocol="tcp" port="80" accept' --permanent

firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="1.1.1.1" accept' 

 

posted @ 2023-08-29 20:47  shenshu  阅读(63)  评论(0编辑  收藏  举报