centos7防火墙

作者: 小小的小帅 | 来源:发表于2019-06-13 10:24 被阅读0次

默认防火墙firewall

由于centos7默认是使用firewall作为防火墙,下面介绍如何将系统的防火墙设置为iptables。
停止firewall
systemctl stop firewalld.service
禁止firewall开机启动
systemctl disable firewalld.service

防火墙iptables

  1. 安装iptables
    yum install iptables-services
  2. 设置开机启动、不启动
    systemctl enable iptables
    systemctl disable iptables
  3. 编辑防火墙文件 (建议都在配置文件配置,不要命令配置)
    vi /etc/sysconfig/iptables
    添加80和3306端口 等等(自己配置)
    -A INPUT -m state –state NEW -m tcp -p tcp –dport 80 -j ACCEPT    #80端口开放
  4. 重启防火墙使配置文件生效
    systemctl restart iptables.service
    设置iptables防火墙为开机启动项
    systemctl enable iptables.service
    service iptables start #启动服务
    service iptables stop   #停止服务
    service iptables restart  #重启服务
  5. 关闭SELINUX
    vi /etc/selinux/config #注释以下配置 
    SELINUX=enforcing 
    SELINUXTYPE=targeted #增加以下配置 
    SELINUX=disabled #使配置立即生效 
    setenforce 0

相关文章

  • linux命令

    centos7启动防火墙 centos7停止防火墙/关闭防火墙 centos7重启防火墙 注意:新增/删除操作需要...

  • CentOS7防火墙设置

    CentOS7 与之前版本在防火墙配置上不同,防火墙从iptables变成了firewalld Centos7默认...

  • Linux常用命令

    CentOS7 防火墙增加端口

  • Linux使用-FAQ

    CentOS7 关闭防火墙 参考:CentOS7 关闭防火墙 在我的虚拟机下启动服务 进程管理 文件管理 查看日志...

  • centos7关闭防火墙

    centos7 默认防火墙是firewalld 所以查看防火墙状态命令:systemctl status ...

  • linux防火墙查看状态firewall、iptable

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • CentOS 7.2 关闭防火墙

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • Linux防火墙命令

    CentOS7 的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之...

  • centos7和centos6的防火墙关闭命令

    CentOS7的防火墙配置跟以前版本有很大区别,CentOS7这个版本的防火墙默认使用的是firewall,与之前...

  • linux服务器常用

    Centos7 打开80端口防火墙命令

网友评论

    本文标题:centos7防火墙

    本文链接:https://www.haomeiwen.com/subject/emzgxctx.html