安装防火墙

https://blog.csdn.net/mehnr/article/details/80325608

在安装过后,启动防火墙,查看防火墙状态:

systemctl start firewalld

systemctl status firewalld

如果结果如下则正常:

    [root@localhost system]# systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
       Active: active (running) since Tue 2018-01-30 04:39:48 EST; 4s ago
         Docs: man:firewalld(1)
     Main PID: 836 (firewalld)

如果结果如下则没有正常运行:

     #systemctl status firewalld
    ● firewalld.service - firewalld - dynamic firewall daemon
       Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
       Active: inactive (dead) since Mon 2018-05-07 17:50:20 CST; 7min ago
         Docs: man:firewalld(1)
      Process: 1102 ExecStart=/usr/sbin/firewalld --nofork --nopid $FIREWALLD_ARGS (code=exited, status=0/SUCCESS)
     Main PID: 1102 (code=exited, status=0/SUCCESS)
    
    May 07 17:50:19 server2 systemd[1]: Starting firewalld - dynamic firewall daemon...
    May 07 17:50:20 server2 firewalld[1102]: ERROR: Exception DBusException: org.freedesktop.DBus.Error.AccessDenied: Connection ":1.5" is not allowed to own the s
    May 07 17:50:20 server2 systemd[1]: Started firewalld - dynamic firewall daemon.
    Hint: Some lines were ellipsized, use -l to show in full 
 

如果防火墙没有正常运行则需要执行如下解决方法:
在/etc/dbus-1/system.d/目录下创建com.foxbryant.demo.conf (名称随意,以.conf结尾即可) 内容如下:

    <!DOCTYPE busconfig PUBLIC  
         "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN"  
         "http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">  
        <busconfig>  
          
          <!-- Only root and devel can own the service -->  
          <policy user="root">  
            <allow own="com.foxbryant.demo"/>  
            <allow send_destination="com.foxbryant.demo"/>  
            <allow send_interface="com.foxbryant.demo"/>  
          </policy>  
          
          <policy user="foxbryant">  
            <allow own="com.foxbryant.demo"/>  
            <allow send_destination="com.foxbryant.demo"/>  
            <allow send_interface="com.foxbryant.demo"/>  
          </policy>  
          
        </busconfig>  

然后

[root@localhost system]# vi /etc/dbus-1/system.d/com.foxbryant.demo.conf
[root@localhost system]# systemctl restart firewalld
[root@localhost system]# systemctl status firewalld
re.:
http://blog.csdn.net/foxbryant/article/details/54917408