CentOS 7 防火墙

2018-09-26  本文已影响0人  星际大镖客

CentOS 7.0以上版本默认使用的是firewall作为防火墙。

#查看默认防火墙是否运行
[root@localhost ~]# firewall-cmd --state
not running 
[root@localhost ~]# systemctl status firewalld.service
firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; 
disabled; 
vendor preset: enabled)
Active: inactive (dead) 
[root@localhost ~]# systemctl stop firewalld.service 
# 关闭防火墙
[root@localhost ~]# systemctl disable firewalld.service
 #禁止开机启动
[root@localhost ~]# systemctl is-enabled firewalld.service;echo $? 
#查看服务是否开机启动
[root@localhost ~]# systemctl list-unit-files|grep enabled 
#查看已启动的服务列表
命令 中文翻译
systemctl start firewalld 别烦我
systemctl stop firewalld 快撩我
systemctl enable firewalld 开启高冷模式
systemctl disable firewalld 彻底放飞自我
systemctl restart firewalld 我胡汉三又回来啦
firewall-cmd --list-ports
firewall-cmd --zone=public --add-port=22/tcp --permanent
firewall-cmd --permanent --query-port=22/tcp
 firewall-cmd --zone=public --remove-port=22/tcp --permanent 
firewall-cmd --reload或firewall-cmd --complete-reload
上一篇 下一篇

猜你喜欢

热点阅读