CentOS 7.0如何将iptables作为防火墙(默认使用的是firewall作为防火墙)

1、直接关闭防火墙
 systemctl stop firewalld.service #停止firewall
 systemctl disable firewalld.service #禁止firewall开机启动

2、设置 iptables service
 yum -y install iptables-services

 如果要修改防火墙配置,如增加防火墙端口3306
 vi /etc/sysconfig/iptables
 增加规则
 -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
 保存退出后

 systemctl restart iptables.service #重启防火墙使配置生效
 systemctl enable iptables.service #设置防火墙开机启动
 最后重启系统使设置生效即可

------------------------------------------------------------------------------------

启动/关闭iptables防火墙
 重启后有效:
  开启: chkconfig iptables on
  关闭: chkconfig iptables off
 重启后失效:
  开启: service iptables start
  关闭: service iptables stop

点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

2020年前端实用代码段,为你的工作保驾护航

有空的时候,自己总结了几个代码段,在开发中也经常使用,谢谢。1、使用解构获取json数据let jsonData  id: 1,status: "OK",data: 'a', 'b';let  id, status, data: number   jsonData;console.log(id, status, number )

Centos7中使用iptables,docker容器中实例,外网端口无法访问

因微信小程序需要https的域名访问方式,阿里云无法通过IP和端口绑定域名,只能通过IP进行绑定,故如果不想直接使用443端口,就只能进行端口映射了。这里我使用iptables。由于centos7默认是使用firewall作为防火墙,下面介绍如何将系统的防火墙设置为iptables。停止firewall systemctlstopfire