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. 五、CI框架之通过带路径的view视图路径访问

    一.如果需要现在的某个目录的View界面,需要在controller中写入文件路径 二.访问http://127.0.0.1/CodeIgniter-3.1.10/index.php/显示如下: 不忘 ...

  2. RGB转到HSV色彩空间转换

    原文链接:https://blog.csdn.net/lsg19920625/article/details/78416649

  3. openstack trove mongodb配置项

    systemLog.verbosity 组件的默认日志消息详细程度级别. 详细程度级别决定MongoDB输出的信息和调试消息量. 详细级别可以在0到5之间: 0是MongoDB的默认日志详细程度级别, ...

  4. 新iPhone泄密12人被捕,苹果这是下狠手的节奏

    一直以来,苹果在保密这件事儿上就秉持着强硬态度.还记得当年乔老爷子在的时候,苹果的保密工作在科技行业算得上是首屈一指.每款iPhone及其他新品在正式发布前,几乎不会被曝出什么消息.而这,或许也是&q ...

  5. django-blog:多对多查询

    简单写一下多对多查询model 不是多对多的字段我就没写上来的 class Tag(models.Model): name = models.CharField(max_length=20,verbo ...

  6. 【每日Scrum】第六天冲刺

    一.计划会议内容 数据库仍然有问题,决定先绕过数据库,进行软件内容设计与界面ui美化. 二.任务看板 三.scrum讨论照片 四.产品的状态 无 五.任务燃尽图

  7. 视频课程 | 云原生下的Serverless浅谈

    京东云开发者社区在3月底于北京举行了以"Cloud Native时代的应用之路与开源创新"为主题的技术沙龙,现场多位技术大咖与开发者们面对面就Cloud Native进行了深入交流 ...

  8. @JsonIgnoreProperties 不生效

    定义类如下, import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.annota ...

  9. CSS 选择器权重计算规则(转)

    其实,CSS有自己的优先级计算公式,而不仅仅是行间>内部>外部样式:ID>class>元素. 一.样式类型 1.行间 <h1 style="font-size: ...

  10. python 常用函数用法

    Assert 断言assert的语法其实有点像是fi 条件分支语句的“近亲”,assert这个关键字称为“断言”,当这个关键字后边的条件为false的时候,程序自动崩溃并抛出AssertionErro ...