参考

相关内容

centos7 中才开始引用firewalld的概念,它是iptables的升级版,以上两者都不是真正的防火墙,都需要与内核netfilter配合使用。

Centos5、6使用iptables来管理服务器防火墙,Centos7 默认是firewalld。

SELinux是Linux一个子安全机制

本地环境

SELinux

/usr/sbin/sestatus -v        # 查看SELinux状态

# 关闭SELinux:
setenforce 0 # 1.临时关闭(不用重启机器)
修改/etc/selinux/config文件将SELINUX=enforcing改为SELINUX=disabled 修改配置文件需要重启机器



firewalld

# 使用systemctl
systemctl stop firewalld.service #关闭firewalld
systemctl start firewalld.service #启动服务
systemctl restart firewalld.service #重启服务
systemctl enable firewalld.service #启用firewalld系统重启firewalld服务加载
systemctl disable firewalld.service #禁用firewalld系统重启firewalld服务不会加载
firewall-cmd --list-ports #查看已经开放的端口
firewall-cmd --zone=public --add-port=80/tcp --permanent #开启80端口:命令含义:–zone #作用域–add-port=80/tcp #添加端口,格式为:端口/通讯协议–permanent #永久生效,没有此参数重启后失效 # 使用service
service firewalld start # 开启
service firewalld restart # 重启
service firewalld stop # 关闭 # 使用firewall-cmd
firewall-cmd --state #查看状态

iptables

systemctl start iptables.service    # 开启iptables防火墙的命令是
systemctl restart iptables.service # 重启iptables防火墙的命令是
systemctl stop iptables.service # 关闭iptables防火墙的命令是
systemctl status iptables.service #查看iptables防火墙状态的命令是
service iptables status # 查看防火墙状态
service iptables stop # 停止防火墙
service iptables start # 启动防火墙
service iptables restart # 重启防火墙
chkconfig iptables off # 永久关闭防火墙
chkconfig iptables on # 永久关闭后重启

安装iptables

yum list | grep iptables    #查看yum源是否有iptables的安装包

yum install -y iptables.x86_64                                #安装iptables.x86_64 :该安装包主要包含iptables的相关命令以及iptables的相关模块
yum install -y iptables-services.x86_64               #该安装包主要配置文件、启动或重启用的systemctl的服务



iptables-services 包含信息

centos 防火墙 iptables firewalld SELinux的更多相关文章

  1. CentOS防火墙iptables的配置方法详解

    CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助. iptables是与Linux ...

  2. 关闭Linux防火墙(iptables) 及 SELinux

    一.关闭防火墙 1.重启后永久性生效: 开启:chkconfig iptables on 关闭:chkconfig iptables off 2.即时生效,重启后失效: 开启:service ipta ...

  3. 关闭Linux中的iptables,firewalld,SELINUX

    firewalld 停止firewalld服务 [root@VM_0_13_centos var]# systemctl stop firewalld 或 [root@VM_0_13_centos v ...

  4. CentOS防火墙iptables使用

    1.1 企业安全优化配置原则 尽可能不给服务器配置外网ip ,可以通过代理转发或者通过防火墙映射.并发不是特别大情况有外网ip,可以开启防火墙服务高并发的情况,不能开iptables,会影响性能,利用 ...

  5. 【Linux】- CentOS 防火墙iptables和firewall

    1 iptables防火墙 1.1 基本操作 # 查看防火墙状态 service iptables status   # 停止防火墙 service iptables stop   # 启动防火墙 s ...

  6. linux设置iptables防火墙的详细步骤(centos防火墙设置方法)

    CentOS系统也是基于linux中的它的防火墙其实就是iptables了,下面我来介绍在CentOS防火墙iptables的配置教程,希望此教程对各位朋友会有所帮助.   iptables是与Lin ...

  7. 解决宿主机不能访问虚拟机CentOS中的站点 | 更新CentOS防火墙设置开启80端口访问

    前阵子在虚拟机上装好了centos6.0,并配好了nginx+php+mysql,但是本机就是无法访问.一直就没去折腾了. 具体情况如下 1.本机能ping通虚拟机 2.虚拟机也能ping通本机 3. ...

  8. CentOS 7.0如何安装配置iptables和seLinux以及firewalld

    一.配置防火墙,开启80端口.3306端口 CentOS .0默认使用的是firewall作为防火墙,这里改为iptables防火墙. .关闭firewall: systemctl stop fire ...

  9. ifconfig 命令,改变主机名,改DNS hosts、关闭selinux firewalld netfilter 、防火墙iptables规则

    ifconfig 命令用于查看网络相关的命令: 安装:yum install net-tools -y  ifdown  eth_name  关闭网卡  ifup  eth_name   开启网卡 配 ...

随机推荐

  1. [Linux系统] (6)LVS负载均衡

    部分内容转自:https://blog.csdn.net/weixin_40470303/article/details/80541639 一.LVS简介  LVS(Linux Virtual Ser ...

  2. ie文件断点续传

    一.概述 所谓断点续传,其实只是指下载,也就是要从文件已经下载的地方开始继续下载.在以前版本的HTTP协议是不支持断点的,HTTP/1.1开始就支持了.一般断点下载时才用到Range和Content- ...

  3. 4000余字为你讲透Codis内部工作原理

    一.引言 Codis是一个分布式 Redis 解决方案,可以管理数量巨大的Redis节点.个推作为专业的第三方推送服务商,多年来专注于为开发者提供高效稳定的消息推送服务.每天通过个推平台下发的消息数量 ...

  4. 20175215 2018-2019-2 第七周java课程学习总结

    第八章 常用实用类 8.1 String类 Java专门提供了用来处理字符序列的String类.String类在java.lang包中,由于java.lang包中的类被默认引入,因此程序可以直接使用S ...

  5. NP-Hard问题和NP-Complete问题

    对 NP-Hard问题和NP-Complete问题的一个直观的理解就是指那些很难(很可能是不可能)找到多项式时间算法的问题.因此一般初学算法的人都会问这样一个问题:NP-Hard和NP-Complet ...

  6. windows spark1.6

    jdk1.7 scala 2.10.5 spark 1.6.1 http://spark.apache.org/downloads.html hadoop 2.6.4 只需要留bin https:// ...

  7. 【JVM】jstack 查询占用最大资源线程|排查死循环等

    jstack 应用 首先通过:ps -ef|grep java 得到java pid 查看哪个线程占用最多资源: 找出该进程内最耗费CPU的线程,可以使用ps -Lfp pid或者ps -mp pid ...

  8. wordpress 更新时需要FTP 服务器账户密码的解决方法

    首先进入 apache下的wordpress 的目录下 (这是apache服务器默认安装的路径) cd /var/www 接着,给html整个文件夹进行赋值权限,如果不赋予权限 更新的时候会报权限不足 ...

  9. ORCAD导网表:遇"No_connect" property

    问题: Orcad Capture中将No Connect标识放置到了原本应该放置连线的管脚上,不知道怎么删除. 虽然添加一根Wire可以掩盖该管脚上已经添加的No Connect标识,但是到处网表的 ...

  10. 使用Android自带的资源

    Android自带的资源文件有 :https://developer.android.google.cn/reference/android/R.html 代码中使用如下: 1.查看源代码的资源文件 ...