.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. ABC156 F - Modularness

    题目链接 题意还是比较清楚的,给你q个询问,对每组询问的模数和初始值不同,求满足条件\(a_j~\textrm{mod}~m_i < a_{j + 1}~\textrm{mod}~m_i,(0 ...

  2. Windows事件ID

    51 Windows 无法找到网络路径.请确认网络路径正确并且目标计算机不忙或已关闭.如果 Windows 仍然无法找到网络路径,请与网络管理员联系. 52 由于网络上有重名,没有连接.请到“控制面板 ...

  3. WebApplicationInitializer初始化web应用,不需要web.xml

    web应用的上下文层次结构 很多时候加的切面不起作用,是因为加错地方了 1.直接初始化,上下文只有一个context import org.springframework.web.WebApplica ...

  4. 浏览器 User-Agent 整理

    也可以去这里查询:http://tools.jb51.net/table/useragent window.navigator.userAgent 1) Chrome Win7: Mozilla/5. ...

  5. PAT 1003 Emergency (25分)

    As an emergency rescue team leader of a city, you are given a special map of your country. The map s ...

  6. 14. 深入解析Pod对象(一)

    14. 深入解析Pod对象(一) """ 通过前面的讲解,大家应该都知道: Pod,而不是容器,它是 Kubernetes 项目中的最小编排单位.将这个设计落实到 API ...

  7. JavaScript 种一颗二叉树

    /* 实现一颗树 结点类:Tree 包含左子树left,右子树right,根节点root,缺省为null 构造设置value 树类:Trees 构造:默认根节点为null insert: 如果当前根节 ...

  8. Vue——手机号、验证码登录(设置按钮60s禁用倒计时)

    最近在做一个Vue项目,前端通过手机号.验证码登录,获取验证码按钮需要设置60s倒计时(点击一次后,一分钟内不得再次点击).先看一下效果图: 输入正确格式的手机号码后,“获取验证码”按钮方可点击:点击 ...

  9. Euler Sums系列(三)

    \[\Large\sum_{n=1}^{\infty}\frac{\left(H_{n}^{(2)}\right)^{2}}{n^{2}}=\frac{19}{24}\zeta(6)+\zeta^{2 ...

  10. 如何判断WLC的FUS版本

    有些时候,我们在升级WLC的时候,被告知需要升级WLC的FUS,以防止某些漏洞和不必要的情况发生. 1.什么是FUS? Field Upgrade Software (FUS),翻译过来,叫“现场升级 ...