firewall-cmd使用--remove-rich-rule删除rich-rule规则

命令格式:
firewall-cmd --permanent --remove-rich-rule '规则列表'
firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="8077" protocol="tcp" to-port="80" to-addr="192.168.4.245"'

下面是示例操作:

#显示规则列表
[root@new-center ~]# firewall-cmd --list-rich-rules 
rule family="ipv4" source address="0.0.0.0/0" forward-port port="2224" protocol="tcp" to-port="2224" to-addr="192.168.11.241"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="1935" protocol="tcp" to-port="1935" to-addr="192.168.4.189"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="23456" protocol="tcp" to-port="23456" to-addr="192.168.4.187"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="10555" protocol="tcp" to-port="10555" to-addr="192.168.4.234"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="8078" protocol="tcp" to-port="8080" to-addr="192.168.4.234"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="8010" protocol="tcp" to-port="8010" to-addr="192.168.11.118"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="8000" protocol="tcp" to-port="8000" to-addr="192.168.11.118"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="3722" protocol="tcp" to-port="22" to-addr="192.168.11.249"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="5080" protocol="tcp" to-port="5080" to-addr="192.168.11.244"
rule family="ipv4" source address="0.0.0.0/0" forward-port port="23389" protocol="tcp" to-port="3389" to-addr="192.168.11.36"
#删除rich rule
[root@new-center ~]# firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="2224" protocol="tcp" to-port="2224" to-addr="192.168.11.241"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="23389" protocol="tcp" to-port="3389" to-addr="192.168.11.36"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="5080" protocol="tcp" to-port="5080" to-addr="192.168.11.244"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="3722" protocol="tcp" to-port="22" to-addr="192.168.11.249"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="8000" protocol="tcp" to-port="8000" to-addr="192.168.11.118"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="8010" protocol="tcp" to-port="8010" to-addr="192.168.11.118"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="8078" protocol="tcp" to-port="8080" to-addr="192.168.4.234"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="10555" protocol="tcp" to-port="10555" to-addr="192.168.4.234"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="23456" protocol="tcp" to-port="23456" to-addr="192.168.4.187"'
success
[root@new-center ~]#  firewall-cmd --permanent --remove-rich-rule 'rule family="ipv4" source address="0.0.0.0/0" forward-port port="1935" protocol="tcp" to-port="1935" to-addr="192.168.4.189"'
success
#重载firewalld
[root@new-center ~]# firewall-cmd --reload 
success
#查看rich-rules 
[root@new-center ~]# firewall-cmd --list-rich-rules 

你可能感兴趣的:(firewall-cmd使用--remove-rich-rule删除rich-rule规则)