iptables防火墙

1、基本操作

# 查看防火墙状态
service iptables status  
# 停止防火墙
service iptables stop  
# 启动防火墙
service iptables start  
# 重启防火墙
service iptables restart  
# 永久关闭防火墙
chkconfig iptables off  
# 永久关闭后重启
chkconfig iptables on  

2、查看防火墙状态,防火墙处于开启状态并且只开放了22端口

3、开启80端口

 vim /etc/sysconfig/iptables
# 加入如下代码,比着两葫芦画瓢 :)
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT

保存退出后重启防火墙

service iptables restart

firewall防火墙

1、查看firewall服务状态

systemctl status firewalld

2、查看firewall的状态

firewall-cmd --state

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

# 开启
service firewalld start
# 重启
service firewalld restart
# 关闭
service firewalld stop

4、查看防火墙规则

firewall-cmd --list-all 

5、查询、开放、关闭端口

# 查询端口是否开放
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:标识添加的端口;

--------------------- 作者:菲宇 来源:CSDN 原文:https://blog.csdn.net/bbwangj/article/details/74502967?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!

cenos 防火墙操作的更多相关文章

  1. CentOS 配置防火墙操作实例(启、停、开、闭端口):

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status< ...

  2. CentOS 配置防火墙操作实例(启、停、开、闭端口)CentOS Linux-FTP/对外开放端口(接口)TomCat相关

    链接地址:http://blog.csdn.net/jemlee2002/article/details/7042991 CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作 ...

  3. CentOS配置防火墙操作实例

    CentOS 配置防火墙操作实例(启.停.开.闭端口): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service iptables status<回 ...

  4. CentOS 配置防火墙操作实例(启、停、开、闭port)

    CentOS 配置防火墙操作实例(启.停.开.闭port): 注:防火墙的基本操作命令: 查询防火墙状态: [root@localhost ~]# service   iptables status& ...

  5. C# 防火墙操作之开启与关闭

    通过代码操作防火墙的方式有两种:一是代码操作修改注册表启用或关闭防火墙:二是直接操作防火墙对象来启用或关闭防火墙.不论哪一种方式,都需要使用管理员权限,所以操作前需要判断程序是否具有管理员权限. 1. ...

  6. C# 防火墙操作之启用与关闭

    通过代码操作防火墙的方式有两种:一是代码操作修改注册表启用或关闭防火墙:二是直接操作防火墙对象来启用或关闭防火墙.不论哪一种方式,都需要使用管理员权限,所以操作前需要判断程序是否具有管理员权限. 1. ...

  7. C# 防火墙操作之特定程序

    将特定程序加入防火墙组,与将特定端口加入防火墙流程类似.详情见“C# 防火墙操作之特定端口”.其主要代码为: /// <summary> /// 允许应用程序通过防火墙 /// </ ...

  8. linux一些基本操作-防火墙操作

    防火墙操作 一.service方式 查看防火墙状态: [root@centos6 ~]# service iptables status iptables:未运行防火墙. 开启防火墙: [root@c ...

  9. CentOS 配置防火墙操作实例(启、停、开、闭端口)

    防火墙的基本操作命令 查询防火墙状态:[root@localhost ~]# service   iptables status<回车> 停止防火墙:[root@localhost ~]# ...

随机推荐

  1. POJ3336 Making the Grade

    思路:DP 提交:1次 题解: 最开始我们可以想到,分两种序列都做一遍. 先来证明一个结论: 存在一种构造,使 \(B\) 中的数都在 \(A\) 中出现过,且这样不劣. (目的是为了转化暂时看起来虚 ...

  2. PHP mysqli_commit() 函数

    关闭自动提交,做一些查询,然后提交查询: <?php // 假定数据库用户名:root,密码:123456,数据库:RUNOOB $con=mysqli_connect("localh ...

  3. sql server 复习笔记1

    查询数据库是否存在: if DB_ID("testDB")is not null; 检查表是否存在: if OBJECT_ID(“textDB”,“U”) is not null ...

  4. [Luogu] 魔板

    https://www.luogu.org/problemnew/show/P1275 #include <iostream> #include <cstdio> #inclu ...

  5. 【概率论】4-1:随机变量的期望(The Expectation of a Random Variable Part I)

    title: [概率论]4-1:随机变量的期望(The Expectation of a Random Variable Part I) categories: - Mathematic - Prob ...

  6. 【概率论】2-3:贝叶斯定理(Bayes' Theorem)

    title: [概率论]2-3:贝叶斯定理(Bayes' Theorem) categories: Mathematic Probability keywords: Bayes' Theorem 贝叶 ...

  7. alarm函数

    alarm函数 设置定时器(闹钟).在指定seconds后,内核会给当前进程发送14)SIGALRM信号.进程收到该信号,默认动作终止. 每个进程都有且只有唯一个定时器. unsigned int a ...

  8. Java分布式互联网架构/微服务/高性能/springboot/springcloud2018年10月16日直播内容

    2018年10月16日直播内容 架构师揭秘springboot对springmvc的自动配置原理 直播地址:https://ke.qq.com/course/179440?tuin=9b386640 ...

  9. Echarts-复杂关系图(源码)

    关系图: 代码: <!DOCTYPE html> <head> <meta charset="utf-8"> <script type=& ...

  10. windows环境rabbitmq安装步骤

    windows环境rabbitmq安装步骤: 1 提前安装erl; 2 rabbitmq安装后自动启动; 3 从开始菜单进入rabbit命令窗,启用插件;   下面是命令: 启用插件 rabbitmq ...