CentOS 7.0默认使用的是firewall作为防火墙

1、查看firewall服务状态

systemctl status firewalld

2、查看firewall的状态

firewall-cmd --state
 

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

#查看linux哪些程序正在使用互联网

firewall-cmd --permanent --list-services ssh dhcpv6-client

# 开启
service firewalld start
# 重启
service firewalld restart


# 关闭
service firewalld stop
4、查看防火墙规则

firewall-cmd --list-all

停止firewall

systemctl stop firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service

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

# 查询端口是否开放
firewall-cmd --query-port=8080/tcp


# 开放80端口
firewall-cmd --permanent --add-port=80/tcp
firewall-cmd --permanent --add-port=8080-8085/tcp


# 移除端口
firewall-cmd --permanent --remove-port=8080/tcp
查看防火墙的开放的端口
firewall-cmd --permanent --list-ports

#重启防火墙(修改配置后要重启防火墙)
firewall-cmd --reload

# 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具;
2、--permanent:表示设置为持久;
3、--add-port:标识添加的端口;

常用命令配置白名单,限制指定ip只能访问服务器指定的端口和去掉开通的端口

#配置规则
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="指定的ip地址" port protocol="tcp" prot="指定的端口" accept" #配置所有端口都可以访问
firewall-cmd --permanent --zone=public --add-port=8080/tcp #批量配置规则
firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="指定的ip地址段(192.168.1.0/24)" port protocol="tcp" prot="指定的端口" accept" #reload配置生效
firewall-cmd --reload #关闭端口
firewall-cmd --zone=public --remove-port=80/tcp --permanent #批量添加区间端口
firewall-cmd --zone=public --add-port=4400-4600/udp --permanent #查看防火墙排除端口
firewall-cmd --permanent --list-port #查看所有开放的端口
iptables -L -n

  

Centos7.5 firewalld防火墙配置的更多相关文章

  1. CentOS7使用firewalld防火墙配置端口

    安装启用firewalld防火墙 CentOS7默认的防火墙是firewalld 如果没有firewalld防火墙,可以执行yum install firewalld 命令进行安装 firewalld ...

  2. Centos7下Firewalld防火墙配置命令

    前    言 服务端口日常被拦截,记录一下常用的命令便于查询 Firewalld服务管理 查看防火墙状态   1 systemctl status firewalld 开机启用/禁用防火墙   1 s ...

  3. CentOS7下Firewall防火墙配置用法详解

    官方文档地址: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide ...

  4. centos7 开启端口防火墙配置(如开启3306或者80端口)

    转载自https://blog.csdn.net/codepen/article/details/52738906 https://www.cnblogs.com/hantianwei/p/57362 ...

  5. CentOS7使用firewalld防火墙

    firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status fir ...

  6. centos7之firewalld防火墙的配置与使用

    firewalld是centos7开始提供的管理防火墙工具,提供了一个动态管理的防火墙,当然低层仍然调用的是 netfilter . 一.区域(zone)firewalld将网卡对应到不同的区域(zo ...

  7. Centos7 iptables firewalld防火墙与selinux配置

    一.iptables防火墙 1.基本操作 # 查看防火墙状态 service iptables status # 停止防火墙 service iptables stop # 启动防火墙 service ...

  8. CentOS7 firewalld防火墙配置

    [root@ecs ~]# firewall-cmd --version       //查看版本0.3.9 [root@ecs ~]# firewall-cmd --state        //查 ...

  9. 02.Linux-CentOS系统Firewalld防火墙配置

    1.firewalld的基本使用 启动: systemctl start firewalld关闭: systemctl stop firewalld查看状态: systemctl status fir ...

随机推荐

  1. Django ORM多表查询练习

    ORM多表查询 创建表结构: from django.db import models # 创建表结构 # Create your models here. class Class_grade(mod ...

  2. Centos7.4系统 httpd模式搭建文件服务器

    环境:服务环境:centos7.4 说明:搭建Apache文件服务器,下载路径为/opt/ymyg(下载路径根据实际需要自己定义) 步骤: 1.安装httpd服务   [root@localhost ...

  3. The 2019 China Collegiate Pro gramming Contest Harbin Site (F. Fixing Banners)

    F. Fixing Banners time limit per test 1 second memory limit per test 512 megabytes input standard in ...

  4. 一天一个设计模式——Strategy策略模式

    一.模式说明 策略模式比较好理解,就是将程序中用到的算法整体的拿出来,并有多个不同版本的算法实现,在程序运行阶段,动态的决定使用哪个算法来解决问题. 举个实际的例子:排序算法的问题,假如我们的程序中需 ...

  5. part7 vuex实现数据共享

    vuex 是数据框架(一个插件)(单项数据的改变流程,组件改数据必须先调Action用dispatch方法) 大型项目vue只能承担视图层的主要内容 大量数据传递的时候,往往需要一个数据框架辅助 例子 ...

  6. JS-表单验证二

    3.范围验证:年龄范围验证: <head> <meta http-equiv="Content-Type" content="text/html; ch ...

  7. maven打包 invalid entry size Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.14.RELEASE:repackage (default) on project

    打包失败,但是不知是具体是什么引起得,使用mvn -e clean package,定位到报错得代码 在定位到代码,打上断点,使用maven 打包debug模式 找到dubbo.properties, ...

  8. PAT Advanced 1106 Lowest Price in Supply Chain (25) [DFS,BFS,树的遍历]

    题目 A supply chain is a network of retailers(零售商), distributors(经销商), and suppliers(供应商)– everyone in ...

  9. PAT Advanced 1094 The Largest Generation (25) [BFS,DFS,树的遍历]

    题目 A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level ...

  10. 可塑性|Exosomes

    五流解释 肿瘤发源于不同组织如果不从各种组织出发,则不能有正确的解决方法. Hallmarks of cancer LncRNAs操作流 Exosomes ,它的基本故事是平衡流,但是具体内涵是操作流 ...