CentOS 7默认使用的是firewall作为防火墙,这里改为iptables防火墙。

firewall操作:

# service firewalld status; #查看防火墙状态

(disabled 表明 已经禁止开启启动 enable 表示开机自启,inactive 表示防火墙关闭状态 activated(running)表示为开启状态)

# service firewalld start;  或者 #systemctl start firewalld.service;      #开启防火墙

# service firewalld stop;  或者 #systemctl stop firewalld.service;         #关闭防火墙

# service firewalld restart;  或者 #systemctl restart firewalld.service;  #重启防火墙

# systemctl disable firewalld.service    #禁止防火墙开启自启

# systemctl enable firewalld      #设置防火墙开机启动

#yum remove firewalld      #卸载firewall

安装iptables防火墙及操作:

#yum install iptables-services              #安装iptables防火墙

#vi /etc/sysconfig/iptables                    #编辑防火墙配置文件,开放3306端口

添加配置:-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

#systemctl restart iptables.service               #最后重启防火墙使配置生效

#systemctl enable iptables.service               #设置防火墙开机启动

Linux之防火墙【CentOS 7】的更多相关文章

  1. Linux中防火墙centos

    一般的防火墙用下面这些简单的配置都能达到目的 1) 重启后生效 开启: chkconfig iptables on 关闭: chkconfig iptables off 2) 即时生效,重启后失效 开 ...

  2. Linux配置tomcat (centos配置java环境 tomcat配置篇 总结三)

    ♣下载安装tomcat7 ♣设置启动和关闭 ♣设置用户名和密码 ♣发布java web项目 声明:这篇教程是建立在前两篇教程的基础上的,所以,还没安装工具和jdk,可以先看这个系列的前面两篇(去到文末 ...

  3. Linux上防火墙开放对应的端口

    在Linux上防火墙开放对应的端口的命令如下: 方式一: [root@localhost sbin]# /sbin/iptables -I INPUT -p tcp --dport 80 -j ACC ...

  4. 转:linux关闭防火墙iptables

    ref:https://jingyan.baidu.com/article/066074d64f433ec3c21cb000.html Linux系统下面自带了防火墙iptables,iptables ...

  5. [转帖]Linux firewalld 防火墙使用

    Linux firewalld 防火墙使用 2018-06-19 19:26:08 蚩尤后裔 阅读数 2101  收藏 更多 分类专栏: Linux   版权声明:本文为博主原创文章,遵循CC 4.0 ...

  6. Linux 基本防火墙设置和开放端口命令

    关闭防火墙 CentOS 7.RedHat 7 之前的 Linux 发行版防火墙开启和关闭( iptables ): 即时生效,重启失效 #开启 service iptables start #关闭 ...

  7. Linux学习之CentOS(二十二)--单用户模式下修改Root用户的密码

    在上一篇随笔里面详细讲解了Linux系统的启动过程 (Linux学习之CentOS(二十一)--Linux系统启动详解),我们知道Linux系统的启动级别一共有6种级别,通过 /etc/inittab ...

  8. linux关闭防火墙

    查看防火墙状态: sudo service iptables status linux关闭防火墙命令: sudo service iptables stop linux启动防火墙命令: sudo se ...

  9. [转] Linux学习之CentOS(十三)--CentOS6.4下Mysql数据库的安装与配置

    from:  http://www.cnblogs.com/xiaoluo501395377/archive/2013/04/07/3003278.html 如果要在Linux上做j2ee开发,首先得 ...

  10. linux学习之centos(三):网卡配置

    Linux系统版本:Centos 6.5 在linux学习之centos(二):虚拟网络三种连接方式和SecureCRT的使用中,使用远程工具SecureCRT,通过“ifconfig eth0 + ...

随机推荐

  1. 基于【 Docker】四 || Docker常用镜像安装

    一.nginx安装 1.拉取镜像:docker pull nginx 2.启动容器:docker run -d -p 80:80 nginx 3.查看nginx:ps aux | grep 'ngin ...

  2. from表单中checkbox的多选,ajax转入后台,后台接受

    var check = [];//定义一个空数组 $("input[name='category']:checked").each(function(i){//把所有被选中的复选框 ...

  3. Go 方法使用

    方法的定义 在 Go 语言里,方法和函数只差了一个,那就是方法在 func 和标识符之间多了一个参数. type user struct { name string, email string, } ...

  4. <s:bean>标签的使用

    今天在使用<s:bean>时出了一个问题,感觉有意思的就记录下来吧,以备学习 在使用这个标签的时候需要注意两个事项: 1.<s:bean>的三个属性 id,name,var,在 ...

  5. 【问题】This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.

    转载请注明出处:https://www.cnblogs.com/kelamoyujuzhen/p/9087725.html  这类问题归根到底就是软件源问题,Linux下安装软件不像windows.L ...

  6. sqlserver 拼接字符串

    SELECT CAST(USER_ID AS VARCHAR) + ',' FROM dbo.AUTH_USER FOR XML PATH('');

  7. SQL分表

    一.为什么要水平分表?简而言之,当单表数据量过大时,无法对其进行有效的维护,以及查询速度严重变慢时,我们就需要对其时行水平分表. 二.什么时候需要水平分表?在数据库结构的设计中,需要充分考虑后期数据的 ...

  8. C# IFormattable 接口重写

    public class Racer : IComparable<Racer>, IFormattable { public int Id { get; private set; } pu ...

  9. koa常用api文档整理

    koa 支持的配置 1.应用配置是 app 实例属性,目前支持的配置项如下 配置项名称 简介 app.name 应用名称(可选项) app.env 默认为 NODE_ENV 或者 developmen ...

  10. [ES2019] Use JavaScript ES2019 flatMap to Map and Filter an Array

    ES2019 introduces the Array.prototype.flatMap method. In this lesson, we'll investigate a common use ...