Centos 7 firewall 命令:
查看已经开放的端口:

firewall-cmd --list-ports

开启端口

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

命令含义:

–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效

重启防火墙

firewall-cmd --reload #重启firewall
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动

CentOS 7 以下版本 iptables 命令
如要开放80,22,8080 端口,输入以下命令即可

/sbin/iptables -I INPUT --p tcp --dport 80 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --
dport 22 -j ACCEPT
/sbin/iptables -I INPUT -p tcp --dport 8080 -j ACCEPT

然后保存:

/etc/rc.d/init.d/iptables save

查看打开的端口:

/etc/init.d/iptables status

关闭防火墙
1) 永久性生效,重启后不会复原

开启: chkconfig iptables on
关闭: chkconfig iptables off

2) 即时生效,重启后复原

开启: service iptables start
关闭: service iptables stop

centos 7.X & centos6.X 防火墙基本命令的更多相关文章

  1. centos6和centos7的防火墙基本命令

    一.centos6: 1.firewall的基本启动/停止/重启命令 $查看防火墙状态: service iptables status (/etc/init.d/iptables status) $ ...

  2. linux 常用命令(二)——(centos6.8-centos7)防火墙的启动、关闭

    centos 6.8 [centos6.5]: 查看chkconfig列表里面是否有iptables的服务: chkconfig | grep iptables 查看防火墙状态: service ip ...

  3. redhat linux/CentOS 6/7 如何关闭防火墙?

    redhat linux/CentOS 6/7 如何关闭防火墙?关闭防火墙iptables的具体命令如下: 临时性的完全关闭防火墙,可以不重启机器(但是重启服务器后iptables防火墙服务会自动随系 ...

  4. CentOS 7.0 关闭firewalld防火墙指令 及更换Iptables防火墙

    CentOS 7.0 关闭firewalld防火墙指令 及更换Iptables防火墙 时间:2014-10-13 19:03:48  作者:哎丫丫  来源:哎丫丫数码网  查看:11761  评论:2 ...

  5. Centos 7和 Centos 6开放查看端口 防火墙关闭打开

    Centos 7 firewall 命令: 查看已经开放的端口: firewall-cmd --list-ports 开启端口 firewall-cmd --zone=public --add-por ...

  6. centos6|centos7防火墙区别 | 网络配置区别

    CentOS 6 Linux防火墙 service iptables status (功能描述:查看防火墙状态) chkconfig iptables –list (功能描述:查看防火墙开机启动状态) ...

  7. CentOS 7.0禁用iptables防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. firewall: systemctl start firewalld.service#启动firewal ...

  8. CentOS 7.0启用iptables防火墙

    CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止fir ...

  9. (转)CentOS 7.0关闭默认防火墙启用iptables防火墙

    场景:在本地虚拟机上使用ftp软件需要进行相应的端口设置,不可避免要访问Cnetos的防火墙,默认firewall操作不方便,所以需要进行相应的替换. 1 配置防火墙,开启80端口.3306端口 1. ...

随机推荐

  1. SQL Server 2012 管理新特性:AlwaysOn 可用性组

    SQL Server 2012 新特性(一)管理新特性:AlwaysOn 一.准备环境 1.准备4台计算机 域控制器DC1,IP地址192.168.1.1 主节点SQL1:IP地址192.168.1. ...

  2. python实现排序算法 时间复杂度、稳定性分析 冒泡排序、选择排序、插入排序、希尔排序

    说到排序算法,就不得不提时间复杂度和稳定性! 其实一直对稳定性不是很理解,今天研究python实现排序算法的时候突然有了新的体会,一定要记录下来 稳定性: 稳定性指的是 当排序碰到两个相等数的时候,他 ...

  3. intelj idea中JRebel激活

    1.下载激活软件 https://github.com/ilanyu/ReverseProxy/releases/tag/v1.0 我这边下载的是: 2.双击运行 3.idea中, 不出意外,应该就激 ...

  4. LinkedHashMap简明

    LinkedHashMap 构造方法摘要 inkedHashMap() 构造一个带默认初始容量 (16) 和加载因子 (0.75) 的空插入顺序LinkedHashMap 实例. LinkedHash ...

  5. Python面向对象——多重继承

    1本文的作用 一个从多个父类继承过来的子类,可以访问所有父类的功能. 2图文介绍 3代码验证 class Contact: all_contacts = [] def __init__(self, n ...

  6. winform中的数据绑定

    1. 简单的数据绑定 例1 using (SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings[& ...

  7. [LeetCode] Construct the Rectangle 构建矩形

    For a web developer, it is very important to know how to design a web page's size. So, given a speci ...

  8. javascript实现双向数据绑定

    双向数据绑定已经是面试中经常被问到的点,需要对原理和实现都要有一定了解. 下面是实现双向绑定的两种方法: 属性劫持 脏数据检查 一.属性劫持 主要是通过Object对象的defineProperty方 ...

  9. ABP领域层知识回顾之---实体

    标题:重温ABP领域层 1. 前言  最近一段时间一直在看<ABP的开发指南>(基于DDD的经典分层架构思想).因为之前一段时间刚看完<领域驱动设计:软件核心复杂性应对之道>, ...

  10. [Codeforces 864A]Fair Game

    Description Petya and Vasya decided to play a game. They have n cards (n is an even number). A singl ...