.iptables防火墙

1.基本操作

# 查看防火墙状态

service iptables status

# 停止防火墙

service iptables stop

# 启动防火墙

service iptables start

# 重启防火墙

service iptables restart

# 永久关闭防火墙

chkconfig iptables off

# 永久关闭后重启

chkconfig iptables on

  

2.开启80端口

vim /etc/sysconfig/iptables

# 加入如下代码

-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

保存退出后重启防火墙

service iptables restart

3.iptables配置操作

待续...

二、firewall防火墙

1.查看firewall服务状态

systemctl status firewalld

出现Active: active (running)切高亮显示则表示是启动状态。

出现 Active: inactive (dead)灰色表示停止,看单词也行。

2.查看firewall的状态

firewall-cmd --state

3.开启、重启、关闭、firewalld.service服务

# 开启

service firewalld start

# 重启

service firewalld restart

# 关闭

service firewalld stop

4.查看防火墙规则

firewall-cmd --list-all

5.firewall开放关闭端口

# 查询端口是否开放

firewall-cmd --query-port=8080/tcp

# 开放80端口

firewall-cmd --permanent --add-port=80/tcp

# 移除端口

firewall-cmd --permanent --remove-port=8080/tcp

#重启防火墙(修改配置后要重启防火墙)

firewall-cmd --reload

# 参数解释

1、firwall-cmd:是Linux提供的操作firewall的一个工具;

2、--permanent:表示设置为持久;

3、--add-port:标识添加的端口;

三.selinux

# 查看selinux状态

[root@localhost ~]# getenforce

Enforcing

# 临时关闭selinux状态

[root@localhost ~]# setenforce 0

[root@localhost ~]# getenforce

Permissive

# 永久关闭

[root@localhost ~]# vim /etc/sysconfig/selinux

SELINUX=enforcing 改为 SELINUX=disabled

Centos7 iptables firewalld防火墙与selinux配置的更多相关文章

  1. CentOS7使用firewalld防火墙配置端口

    安装启用firewalld防火墙 CentOS7默认的防火墙是firewalld 如果没有firewalld防火墙,可以执行yum install firewalld 命令进行安装 firewalld ...

  2. Iptables&Firewalld防火墙

    一.IPtables 1.IPtables入门简介 Netfilter/Iptables(以下简称Iptables)是unix/linux自带的一款优秀且开放源代码的完全自由的基于包过滤的防火墙工具, ...

  3. CentOS7使用firewalld防火墙

    firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...

  4. centos7之firewalld防火墙的配置与使用

    firewalld是centos7开始提供的管理防火墙工具,提供了一个动态管理的防火墙,当然低层仍然调用的是 netfilter . 一.区域(zone)firewalld将网卡对应到不同的区域(zo ...

  5. Centos7下Firewalld防火墙配置命令

    前    言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态   1 systemctl status firewalld 开机启用/禁用防火墙   1 s ...

  6. Centos7.5 firewalld防火墙配置

    CentOS 7.0默认使用的是firewall作为防火墙 1.查看firewall服务状态 systemctl status firewalld 2.查看firewall的状态 firewall-c ...

  7. Centos7和Centos6防火墙开放端口配置方法(避坑教学)

    ▲这篇文章主要为大家详细介绍了Centos7防火墙开放端口的快速方法,感兴趣的小伙伴们可以参考一下! 一.CentOS 7快速开放端口: CentOS升级到7之后,发现无法使用iptables控制Li ...

  8. centos7 iptables/firewalld docker open port

    here are multiple "hackish" ways to do it: scan kernel logs, as mentioned by Jiri (but you ...

  9. CentOS 7 打开关闭FirewallD防火墙端口命令

    CentOS 7 使用firewalld代替了原来的iptables,使用方法如下: >>>关闭防火墙 systemctl stop firewalld.service        ...

随机推荐

  1. BETWEEN

    选取介于两个值之间的数据范围内的值.这些值可以是数值.文本或者日期. 选取 alexa 介于 1 和 20 之间的所有网站: SELECT * FROM table ; NOT BETWEEN 显示不 ...

  2. Robot Framework初级

    一.robot framework环境搭建 二.robot 不同的测试库 三.创建项目 四.变量与常量 五.常用关键字介绍

  3. SaaS paas iaas是什么

    saas:软件即服务,必须对云服务商的定价及合同 条款进行仔细审查保证其安全性,如果存在纠纷云商切断服务话企业可能立马面临困境. paas:平台即服务 iaas :基础架构即服务.

  4. enviroment linux jdk and git and maven

    #java_home export JAVA_HOME=/usr/local/java/jdk1.8.0_211 export JRE_HOME=$JAVA_HOME/jre export CLASS ...

  5. Java入门笔记 09-集合

    一.Collection接口方法:Collection 接口是 List.Set 和 Queue 接口的父接口,该接口里定义的方法既可用于操作 Set 集合,也可用于操作 List 和 Queue 集 ...

  6. VScode使用入门

    使用命令行打开 vscode 如何获取code命令 一般来说,当windows安装了vscode之后,重启之后就可以使用 code 这个命令 也可以直接将vscode直接加入到环境变量中进行使用 命令 ...

  7. 【快学SpringBoot】Spring Cache+Redis实现高可用缓存解决方案

    前言 之前已经写过一篇文章介绍SpringBoot整合Spring Cache,SpringBoot默认使用的是ConcurrentMapCacheManager,在实际项目中,我们需要一个高可用的. ...

  8. Spring Boot Mybatis 使用教程

    Mybatis 在当下互联网开发环境,十分重要.本章主要讲述 Mybatis 如何使用. 从本系列开始,都需要用到 mysql 数据库 和其他一些参考的数据库.请准备相关环节.本章需要以下环境支撑: ...

  9. ServerSuperIO开发记录

    1.需要编写DriverCommand来支撑协议驱动,实现ProtocolCommand抽象类,在驱动初始化时,会加载同一个程序集内的所有实现了IProtocolCommand接口的所有命令,并存储在 ...

  10. CSS水平垂直居中常见方法总结2

    1.文本水平居中line-height,text-align:center(文字)元素水平居中 margin:0 auo 方案1:position 元素已知宽度 父元素设置为:position: re ...