添加某个ip段对某端口的访问
firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="113.0.0.0/8" port port="8003" protocol="tcp" accept'
#重新载入,使配置生效
firewall-cmd --reload
#查看所有配置
firewall-cmd --list-all
删除某个ip对某端口的访问
firewall-cmd --permanent --remove-rich-rule='rule family="ipv4" source address="113.0.0.0/8" port port="8003" protocol="tcp" accept'
#重新载入,使配置生效
firewall-cmd --reload
#查看所有配置
firewall-cmd --list-all
开启端口
[root@centos7 ~]# firewall-cmd –zone=public –add-port=80/tcp –permanent
查询端口号80 是否开启:
[root@centos7 ~]# firewall-cmd –query-port=80/tcp
重启防火墙:
[root@centos7 ~]# firewall-cmd –reload
查询有哪些端口是开启的:
[root@centos7 ~]# firewall-cmd –list-port