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. 在Centos7下源代码安装配置Nginx

    1.安装前准备开发环境安装pcre开发包:yum install -y pcre-devel 安装编译源码所需的工具和库:yum install gcc gcc-c++ ncurses-devel p ...

  2. MVC三层架构在各框架中的特征

    转一篇写得很棒的文章:https://my.oschina.net/win199176/blog/208171?p=7&temp=1495894148424 1.基于web开发中最原始的jsp ...

  3. Relu激活函数的优点

    Relu优点: 1.可以使网络训练更快. 相比于sigmoid.tanh,导数更加好求,反向传播就是不断的更新参数的过程,因为其导数不复杂形式简单. 2.增加网络的非线性. 本身为非线性函数,加入到神 ...

  4. Maven - web 实例

    版权所有,未经授权,禁止转载 章节 Maven – 简介 Maven – 工作原理 Maven – Repository(存储库) Maven – pom.xml 文件 Maven – 依赖管理 Ma ...

  5. CodeForces - 446A DZY Loves Sequences(dp)

    题意:给定一个序列a,求最长的连续子序列b的长度,在至多修改b内一个数字(可修改为任何数字)的条件下,使得b严格递增. 分析: 1.因为至多修改一个数字,假设修改a[i], 2.若能使a[i] < ...

  6. 洛谷 P2658 汽车拉力比赛

    题目传送门 解题思路: 二分答案,然后bfs验证,如果从一个路标可以达到其它所有路标,则答案可行.知道找到最佳答案. AC代码: #include<iostream> #include&l ...

  7. 给rar文件加个自定义头

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  8. Servlet过滤器基础及使用场景

    Servlet过滤器详解 一.过滤器基础 1.Servlet过滤器是Servlet的一种特殊用法,主要用来完成一些通用的操作.比如编码的过滤,判断用户的登陆状态等等.Servlet过滤器的适用场合: ...

  9. CodeForces 51C 二分搜索

    校队选拔神马的事情就不说了,哥们反正是要崛起的人了! 感谢何骐的提醒. 校队选拔的时候又被二分给坑了,所以还想做几道二分搜索的题目来练练手. C - Three Base Stations Time ...

  10. P(Y=y|x;θ)表示什么意思

    https://blog.csdn.net/jh1137921986/article/details/88999539 在机器学习中,特别是学习到关于概率/似然估计方面的内容,经常看到类似P(Y=y| ...