首页 > 代码库 > centos 7如何使用firewalld 添加策略

centos 7如何使用firewalld 添加策略

1、运行、停止、禁用firewalld

启动:# systemctl start  firewalld

查看状态:# systemctl status firewalld 或者 firewall-cmd --state

停止:# systemctl disable firewalld

禁用:# systemctl stop firewalld

2、vim /etc/firewalld/zones/public.xml

<?xml version="1.0" encoding="utf-8"?>

<zone>

  <short>Public</short>

  <description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>

  <service name="dhcpv6-client"/>

  <service name="ssh"/>      ****添加服务

  <service name="https"/>

  <port protocol="tcp" port="8080" />       *****添加端口

</zone>


参考:http://www.jb51.net/article/97964.htm


centos 7如何使用firewalld 添加策略