CentOS 7.0 防火墙操作
CentOS 7.0默认使用的是firewall作为防火墙,之前版本是使用iptables。
所以在CentOS 7执行下面命令是无法查看防火墙状态的。
[root@localhost ~]# service iptables status
Redirecting to /bin/systemctl status iptables.service
Unit iptables.service could not be found.
1
2
3
4
查看防火墙是否关闭
firewall-cmd –state
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]#
1
2
3
开启防火墙
[root@localhost ~]# systemctl start firewalld
[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]#
1
2
3
4
5
关闭防火墙
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]#
1
2
3
4
5
禁止firewall开机启动
[root@localhost ~]# systemctl disable firewalld
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
1
2
3
这样设置的话,下次重启开机的时候就会禁止firewall的启动,即关闭状态。
设置firewall开机启动
[root@localhost ~]# systemctl enable firewalld
Created symlink from /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service to /usr/lib/systemd/system/firewalld.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/firewalld.service to /usr/lib/systemd/system/firewalld.service.
1
2
3
4
这样设置之后,开机就会自动开启防火墙。
显示防火墙应用列表
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]# firewall-cmd --add-service=ftp
success
[root@localhost ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: ssh dhcpv6-client ftp
ports:
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
[root@localhost ~]#
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
使用firewall-cmd --add-service=ftp 之后,列表显示出多了一个ftp服务
---------------------
作者:黄宝康
来源:CSDN
原文:https://blog.csdn.net/huangbaokang/article/details/79923382
版权声明:本文为博主原创文章,转载请附上博文链接!
CentOS 7.0 防火墙操作的更多相关文章
- CentOS 7.0 防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.firewall:systemctl start firewalld.service#启动firewalls ...
- CentOS 7.0防火墙设置
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙.1.关闭firewall:systemctl stop firewalld.servicesystemctl ...
- centos 7.0防火墙导致vagrant端口映射失败
在vagrant上部署了centos7.0后,Vagrantfile端口转发设置后,宿主机访问客户机站点还是无法访问,问题出在:centos7.0以上版本默认会安装firewalld防火墙, fire ...
- Centos 7.0防火墙问题
从Centos7开始,自带的防火墙从iptables更改成了firewall.一般在企业环境,出于人力和稳定性考虑,还是用成熟的技术比较稳妥. 以下是关闭firewall的方法 systemctl s ...
- CentOS 端口和防火墙操作
Centos 7 端口和防火墙命令: 查看已经开放的端口:firewall-cmd --list-ports 开启端口:firewall-cmd --zone=public --add-port=80 ...
- (转)CentOS 7.0关闭默认防火墙启用iptables防火墙
场景:在本地虚拟机上使用ftp软件需要进行相应的端口设置,不可避免要访问Cnetos的防火墙,默认firewall操作不方便,所以需要进行相应的替换. 1 配置防火墙,开启80端口.3306端口 1. ...
- CentOS 7.0关闭默认防火墙启用iptables防火墙
转自:https://www.cnblogs.com/lixuwu/p/6087023.html 阅读目录 1 配置防火墙,开启80端口.3306端口 2 关闭SELINUX 3 CentOS 配置防 ...
- CentOS 7.0关闭默认firewall防火墙启用iptables防火墙
操作系统环境:CentOS Linux release 7.0.1406(Core) 64位CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤. 1.关闭f ...
- CentOS 7.0,启用iptables防火墙
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...
随机推荐
- BestCoder Round #93
这么快两天就过去了啊……昨天是April Fool’s Day,但绝对是我过的所有April Fool’s Day里最没意思的一个…… 估计再不写就要忘了……还是写写吧= = 说好7:00到机房,然而 ...
- 关于 img 父容器比img图片要多4个像素的问题
问题背景: <div> <img src="" /> </div> 图片和div 的宽度相同,div的高度等于图片的高度 结果发现div的高度 ...
- Java 之常用API(一)
常用API 1 API概述 2 Scanner类与String类 3 StringBuilder类 NO.one API概述 1.1 API概述 API(Application Programm ...
- 用户登陆显示cpu、负载、内存信息
#用户登陆显示cpu.负载.内存信息 #!/bin/bash # hostip=`ifconfig eth0 |awk -F" +|:" '/Bcast/{print $4}'` ...
- SQL一次性查询一个字段不同条件下的统计结果
参考了一下这篇文章:https://blog.csdn.net/xichenguan/article/details/51764100 , 感谢原作者 有两个表,分别存放了[操作员]和[单据],要根据 ...
- Sql Server关于日期查询时,如果表中日期到具体某个时间
1.如果查询日期参数为'2017/02/21',而数据库表中的字段为'2017/02/21 12:34:16.963',则需要格式化一下日期才能查询出来,如下 select * from table ...
- Python学习---django知识补充之CBV
Django知识补充之CBV Django: url --> def函数 FBV[function based view] 用函数和URL进行匹配 url --> ...
- Linux 系统的文件类型
Linux文件类型常见:普通文件.目录文件.字符设备文件和块设备文件.符号链接文件 1.1. 普通文件(-) ls -lh 来查看某个文件的属性,可以看到有类似-rwxrwxrwx,值得注意的是第一个 ...
- Mysql常用的锁机制
一.引言 ...
- Redis集群部署-windows
Redis集群部署-windows 前言 为了能体验一下部署Redis集群是一种怎么样的体验,所一边做一边写了这篇记录. 1.准备 从这里下载windows服务端 https://github.com ...