开启端口
 
  firewall-cmd --zone=public --add-port=80/tcp --permanent
 
命令含义:
 
  --zone #作用域
 
  --add-port=80/tcp  #添加端口,格式为:端口/通讯协议
   
  --permanent   #永久生效,没有此参数重启后失效
 
重启防火墙
 
  firewall-cmd --reload
 
 
1、firewalld的基本使用
 
  • 启动: systemctl start firewalld
  • 查看状态: systemctl status firewalld
  • 停止: systemctl disable firewalld
  • 禁用: systemctl stop firewalld
 
2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。
 
  • 启动一个服务:systemctl start firewalld.service
  • 关闭一个服务:systemctl stop firewalld.service
  • 重启一个服务:systemctl restart firewalld.service
  • 显示一个服务的状态:systemctl status firewalld.service
  • 在开机时启用一个服务:systemctl enable firewalld.service
  • 在开机时禁用一个服务:systemctl disable firewalld.service
  • 查看服务是否开机启动:systemctl is-enabled firewalld.service
  • 查看已启动的服务列表:systemctl list-unit-files|grep enabled
  • 查看启动失败的服务列表:systemctl --failed

3.配置firewalld-cmd

  • 查看版本: firewall-cmd --version
  • 查看帮助: firewall-cmd --help
  • 显示状态: firewall-cmd --state
  • 查看所有打开的端口: firewall-cmd --zone=public --list-ports
  • 更新防火墙规则: firewall-cmd --reload
  • 查看区域信息:  firewall-cmd --get-active-zones
  • 查看指定接口所属区域: firewall-cmd --get-zone-of-interface=eth0
  • 拒绝所有包:firewall-cmd --panic-on
  • 取消拒绝状态: firewall-cmd --panic-off
  • 查看是否拒绝: firewall-cmd --query-panic
 
那怎么开启一个端口呢
 
  • 添加
  • firewall-cmd --zone=public --add-port=80/tcp --permanent    (--permanent永久生效,没有此参数重启后失效)
  • 重新载入
  • firewall-cmd --reload
  • 查看
  • firewall-cmd --zone= public --query-port=80/tcp
  • 删除
  • firewall-cmd --zone= public --remove-port=80/tcp --permanent

centos 7 开启端口重启防火墙的更多相关文章

  1. Centos 7 开启端口

    CentOS 7 默认没有使用iptables,所以通过编辑iptables的配置文件来开启80端口是不可以的 CentOS 7 采用了 firewalld 防火墙 如要查询是否开启80端口则: 1 ...

  2. CentOS开启和关闭防火墙

    CentOS Linux开启和关闭防火墙命令有两种,一种是临时的,重启即复原:另外一种是永久性的,重启不会复原.   1) 临时生效,重启后复原 开启: service iptables start ...

  3. centos 6 防火墙开启端口无效问题

    昨天尝试redis在centos的安装,配置文件都检查了,外网就是不能访问 #添加端口开启 $ iptables -A INPUT -p tcp --dport 6379 -j ACCEPT #保存配 ...

  4. Centos防火墙开启端口

    linux系统对外开放80.8080等端口,防火墙设置 我们很多时候在liunx系统上安装了web服务应用后(如tomcat.apache等),需要让其它电脑能访问到该应用,而Linux系统(cent ...

  5. 在CentOS或RHEL防火墙上开启端口

    转载自:https://linux.cn/article-4243-1.html 如果希望在服务器上提供服务,诸如CentOS或RHEL的企业级Linux发行版包含内置的强大防火墙,它们默认的防火墙规 ...

  6. Centos查看端口占用情况和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例)方法一: /sbin/i ...

  7. Centos查看端口占用和开启端口命令

    Centos查看端口占用情况命令,比如查看80端口占用情况使用如下命令: lsof -i tcp:80 列出所有端口 netstat -ntlp 1.开启端口(以80端口为例) 方法一: /sbin/ ...

  8. [转]Centos 查看端口占用情况和开启端口命令

    http://www.cnblogs.com/xqzt/p/4919191.html 1.Centos 查看端口占用 比如查看 80 端口占用情况使用如下命令: lsof -i tcp:80 2.列出 ...

  9. Centos7,配置防火墙,开启端口

    原文链接:https://blog.csdn.net/u013410747/article/details/61696178 适用于CentOS 7 64位的指令: .查看已开放的端口(默认不开放任何 ...

随机推荐

  1. java 8 原版 api 下载地址,

    http://download.oracle.com/otn-pub/java/javafx/8.0.25-b17/javafx-8u25-apidocs.zip?AuthParam=14174994 ...

  2. IOS零碎技术整理(3)-获取wifi列表

    1.   该功能实现基于MobileApple80211框架来进行开发,而目前该框架成为了私有框架,其中的API均为私有API. 如果使用这些API可能导致应用不能上app store或者ios版本升 ...

  3. maven 项目无法发布,无法编译的解决办法

    1 Web Deployment Assembly信息都合理2 重新clear项目,让JAVA代码重新生成.class文件在target目录中

  4. OAF_开发系列19_实现OAF对话框提示dialogPage(案例)

    20150716 Created By BaoXinjian

  5. eclipse中 报出The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误

    在Myeclispe部署项目后 报错 The type javax.servlet.http.HttpServlet cannot be resolved. It is indirect错误 如果在M ...

  6. Django 之 ForeignKey、ManyToMany的访问方式

    1.ForeignKey 情况I: from django.db import models class Blog(models.Model): pass class Entry(models.Mod ...

  7. Java 多张图片合成一张 drawImage

      package com.yunfengtech.solution.business; import java.awt.Color; import java.awt.Graphics; import ...

  8. linux中mysql运程连接时错误host ‘192.168.0.1’ is not allowed to connect to this MySql server

    1.改表法 可能是你的帐号不允许从远程登陆,只能在localhost.这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "u ...

  9. LCA

    2016.1.28 LCA,就是最近公共祖先,这里介绍倍增的算法. 首先我们要预处理,设f[i][j]为编号为i的节点的2j级祖先,所谓2j级祖先,就是从i节点开始往树的上层数2j个节点.如下图所示 ...

  10. FreeBSD从零开始---安装后配置(二)

    系统优化及安全设置   上次说了FreeBSD基本的软件安装和配置,接下来会说系统的详细配置和安全性设置   一.系统优化设置   1.网络相关设置   网卡和IP地址设置: 如果在安装时没有设置IP ...