firewalld的基本使用

2017-08-22  本文已影响0人  那个初衷

1.基本使用

[root@centos]# systemctl start firewalld
[root@centos]#  systemctl stop firewalld
[root@centos]# systemctl enable firewalld
[root@centos]# systemctl disable firewalld
[root@centos]# systemctl status firewalld 

2. systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。

[root@centos]# systemctl start firewalld.service
[root@centos]# systemctl stop firewalld.service
[root@centos]# systemctl restart firewalld.service
[root@centos]# systemctl status firewalld.service
[root@centos]# systemctl enable firewalld.service
[root@centos]# systemctl disable firewalld.service
[root@centos]# systemctl is-enabled firewalld.service
[root@centos]# systemctl list-unit-files|grep enabled
[root@centos]# systemctl --failed

3. 配置firewalld-cmd

[root@centos]# firewall-cmd --version
[root@centos]# firewall-cmd --help
[root@centos]# firewall-cmd --state
[root@centos]# firewall-cmd --zone=public --list-ports
[root@centos]# firewall-cmd --reload
[root@centos]# firewall-cmd --get-active-zones
[root@centos]# firewall-cmd --get-zone-of-interface=eth0
[root@centos]# firewall-cmd --panic-on
[root@centos]# firewall-cmd --panic-off
[root@centos]# firewall-cmd --query-panic

那怎么开启一个端口呢

# --permanent永久生效,没有此参数重启后失效
[root@centos]# firewall-cmd --zone=public --add-port=80/tcp --permanent    
[root@centos]# firewall-cmd --reload
[root@centos]# firewall-cmd --zone= public --query-port=80/tcp
[root@centos]# firewall-cmd --zone= public --remove-port=80/tcp --permanent
上一篇 下一篇

猜你喜欢

热点阅读