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

sunshinekimi sunshinekimi     2022-12-05     532

关键词:

1、firewalld的基本使用
启动: systemctl start firewalld
关闭: systemctl stop firewalld
查看状态: systemctl status firewalld 
开机禁用  : systemctl disable firewalld
开机启用  : systemctl enable firewalld
 
查看所有打开的端口: firewall-cmd --zone=public --list-ports
那怎么开启一个端口呢
添加
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
 

方法二:使用iptables
1、先运行如下命令:

/sbin/iptables -I INPUT -p tcp --dport xxx -j ACCEPT

2、然后运行:

/etc/rc.d/init.d/iptables save 

或者这个命令:

1、-A INPUT -m state –state NEW -m tcp -p tcp –dport xxx -j ACCEPT 

2、在运行这个命令:

-A INPUT -j REJECT –reject-with icmp-host-prohibited

注:xxx ——表示你要开启的端口号,如:6379

测试:在windows下按下win+R键,输入cmd,运行命令(需开启telnet),如果变成空界面表示成功:

         telnet  192.168.xx.xx 6379


注:开启telnet方法如下:

1. 进入控制面板,选择程序;

技术图片

2. 点击程序,进入程序和功能;

技术图片

3.勾选telnet功能,点击确定即可。

技术图片

 

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的功能于一体。启动一个服务... 查看详情