Centos 7之Firewalld相关命令详细介绍
centos 7之firewalld相关命令详细介绍
引言:centos 7是目前非常流行的linux发行版本,本文将重点介绍如何来使用firewalld相关命令启动服务以及添加服务或者端口等操作。
1. 查看firewall服务状态
>> systemctl status firewalld
[root@flybird ~]# systemctl status firewalld ● firewalld.service - firewalld - dynamic firewall daemon loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) active: inactive (dead)
显示当前的firewall并未启动
2. 启动/关闭firewall
>> systemctl start/stop firewalld
root@flybird ~]# systemctl start firewalld [root@flybird ~]# 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 fri 2016-12-02 23:17:09 cst; 11s ago main pid: 1279 (firewalld) cgroup: /system.slice/firewalld.service └─1279 /usr/bin/python -es /usr/sbin/firewalld --nofork --nopid
3. 禁用或者启用firewall
>> systemctl disable/enable firewalld
4. 查看端口是否开放
>>> firewall-cmd --query-port=8020/tcp
5. 新增开发端口
>> firewall-cmd --add-port=5000/tcp --permanent
[root@flybird ~]# firewall-cmd --query-port=5000/tcp no [root@flybird ~]# firewall-cmd --add-port=5000/tcp --permanent success
6. 关于服务
>> firewall-cmd --add-service=ftp --permanent
>> firewall-cmd --remove-service=ftp --permanent
7. 查看firewall状态
>> firewall-cmd --status
>> systemctl status firewalld
8. 查看 firewall目前开放的内容
>> firewall-cmd --list-all
[root@flybird ~]# firewall-cmd --list-all public (default) interfaces: sources: services: dhcpv6-client http ssh ports: 443/tcp 80/tcp 3306/tcp 6739/tcp 10051/tcp 10050/tcp masquerade: no forward-ports: icmp-blocks: rich rules:
9. 查看开发的端口
>> firewall-cmd --list-port
10. 查看firewall-cmd命令的使用说明
>> firewall-cmd --help
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
上一篇: spark笔记(二)之RDD常用算子