.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. sqlserver查询使用with(nolock)详解

    所有Select加 With (NoLock)解决阻塞死锁 在查询语句中使用 NOLOCK 和 READPAST 处理一个数据库死锁的异常时候,其中一个建议就是使用 NOLOCK 或者 READPAS ...

  2. 【代码学习】PYTHON 线程

    一.使用threading模块多线程执行 可以明显看出使用了多线程并发的操作,花费时间要短很多 创建好的线程,需要调用start()方法来启动 #coding=utf-8 import threadi ...

  3. python-turtle-画雪花-2种方法及效果的详解

    1.方法一: 代码: #python3.8 #xuguojun #2020.1.30 #导出模块 import turtle as t import random as r #定义画雪 def dra ...

  4. template-组件封装

    HTML: //:ligit='ligit' 一致 <div id='app'> <template-swiper :ligit='ligit'></template-s ...

  5. java作业 11.10

    package text3; import java.io.File; import java.io.IOException; import java.nio.file.Files; public c ...

  6. Linux学习:进入与退出系统

    进入Linux系统:必须要输入用户的账号,在系统安装过程中可以创建以下两种帐号: 1.root--超级用户帐号(系统管理员),使用这个帐号可以在系统中做任何事情. 2.普通用户--这个帐号供普通用户使 ...

  7. 最全的Java操作Redis的工具类,使用StringRedisTemplate实现,封装了对Redis五种基本类型的各种操作!

    转载自:https://github.com/whvcse/RedisUtil 代码 ProtoStuffSerializerUtil.java import java.io.ByteArrayInp ...

  8. C++11特性中的to_string

    写在最前面,本文摘录于柳神笔记 to_string 的头⽂件是 #include , to_string 最常⽤的就是把⼀个 int 型变量或者⼀个数字转化 为 string 类型的变量,当然也可以转 ...

  9. Math 用法

    console.log(Math.abs(-5)) 取绝对值 console.log(Math.round(5.1)) 取四舍五入 5.5 为中间值 取5 console.log(Math.ceil( ...

  10. Jquery练习1

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...