centos7使用firewalld打开关闭防火墙与端口

yuanlp yuanlp     2022-09-14     551

关键词:

CentOS 7 默认没有使用iptables,所以通过编辑iptables的配置文件来开启80端口是不可以的

CentOS 7 采用了 firewalld 防火墙

 

如要查询是否开启80端口则:

1
2
[[email protected] ~]# firewall-cmd --query-port=80/tcp
no

显然80端口没有开启

下面我们开启80端口:

1
2
[[email protected] ~]# firewall-cmd --add-port=80/tcp
success
 
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

centos7使用firewalld打开关闭防火墙与端口

CentOS7使用firewalld打开关闭防火墙与端口1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合 查看详情

centos7使用firewalld打开关闭防火墙与端口

...无法使用iptables控制Linuxs的端口,google之后发现Centos7使用firewalld代替了原来的iptables下面记录如何使用firewalld开放Linux端口:1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirew 查看详情

centos7使用firewalld打开关闭防火墙与端口

 1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld开机禁用:systemctldisablefirewalld开机启用:systemctlenablefirewalld2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前s 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld 开机禁用 :systemctldisablefirewalld开机启用 : systemctlenablefirewalld  2.systemc 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld 开机禁用 :systemctldisablefirewalld开机启用 : systemctlenablefirewalld  2.systemc 查看详情

centos7使用firewalld打开关闭防火墙与端口

 1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld 开机禁用 :systemctldisablefirewalld开机启用 : systemctlenablefirewalld  2.s 查看详情

centos7使用firewalld打开关闭防火墙和端口

1、firewalld简介firewalld是centos7的一大特性,最大的好处有两个:支持动态更新,不用重启服务;第二个就是加入了防火墙的“zone”概念firewalld有图形界面和工具界面,由于我在服务器上使用,图形界面请参照官方文档,本文以字... 查看详情

centos7使用firewalld打开关闭防火墙与端口

原文地址:https://www.cnblogs.com/moxiaoan/p/5683743.html 1、firewalld的基本使用启动:systemctlstartfirewalld关闭:systemctlstopfirewalld查看状态:systemctlstatusfirewalld 开机禁用 :systemctldisablefirewalld开机启用 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的启用和关闭:开启:#systemctlstartfirewalld.service系统默认状态下防火墙是开启的,如果需要在windows上使用SSH协议、使用Xshell远程控制虚拟机上的Lcentos7,那么应该先停用、关闭防火墙。禁止开机启动防火墙:#systemctldisable... 查看详情

centos7使用firewalld打开关闭防火墙与端口

firewalld的基本使用启动systemctlstartfirewalld停止systemctldisablefirewalld禁用systemctlstopfirewalld查看状态systemctlstatusfirewalld配置firewalld-cmd查看版本firewall-cmd--version查看帮助firewall-cmd--help显示状态firewall-cmd--st 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld 停止:systemctldisablefirewalld禁用:systemctlstopfirewalld 2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动 查看详情

centos7使用firewalld打开关闭防火墙与端口

1、firewalld的基本使用启动:systemctlstartfirewalld查看状态:systemctlstatusfirewalld停止:systemctldisablefirewalld禁用:systemctlstopfirewalld2.systemctl是CentOS7的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。启动一个服务... 查看详情