查看已有规则:
firewall-cmd --list-all
添加:
firewall-cmd --zone=public --add-port=6666/tcp --permanent
firewall-cmd --zone=public --add-port=7777/tcp --permanent
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --zone=public --add-port=9999/tcp --permanent
删除:
firewall-cmd --zone= public --remove-port=6666/tcp --permanent
firewall-cmd --zone= public --remove-port=7777/tcp --permanent
firewall-cmd --zone= public --remove-port=8888/tcp --permanent
firewall-cmd --zone= public --remove-port=9999/tcp --permanent
添加指定ip访问特定端口规则:
firewall-cmd --permanent --add-rich-rule 'rule family=ipv4 source address=192.168.0.111 port port=8088 protocol=tcp accept'
删除指定某个ip访问特定端口规则:
firewall-cmd --permanent --remove-rich-rule="rule family="ipv4" source address="192.168.0.111" port protocol="tcp" port="8088" accept"
网友评论