Centos 7之Firewalld相关命令详细介绍
Centos 7之Firewalld相关命令详细介绍
引言:Centos 7是目前非常流行的Linux发行版本,本文将重点介绍如何来使用firewalld相关命令启动服务以及添加服务或者端口等操作。
1. 查看firewall服务状态
>> systemctl status firewalld
1
2
3
4
|
[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
1
2
3
4
5
6
7
8
|
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
1
2
3
4
|
[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
1
2
3
4
5
6
7
8
9
10
|
[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
感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!
原文链接:http://blog.csdn.net/blueheart20/article/details/53440359
本文由主机测评网发布,不代表主机测评网立场,转载联系作者并注明出处:https://zhuji.jb51.net/centos/1156.html