521源码-免费网络教程-Linux如何增加安全组端口(命令行方式)

更多网站源码学习教程,请点击👉-521源码-👈获取最新资源

使用命令行方式增加Linux的安全组端口

我们这里以 Centos7.x 为例

firewalld 常用命令

服务的名称是 firewalld

#查看firewall防火墙状态

systemctl status firewalld

等价命令

service firewalld status

#开启firewall防火墙

systemctl start firewalld.service

等价命令

service firewalld start

#关闭firewall防火墙

systemctl stop firewalld.service

等价命令

service firewalld stop

#禁止firewall开机启动,此操作尽量不要用

systemctl disable firewalld.service

操作命令是 firewall-cmd

复制代码
firewall-cmd --list-ports
#查看firewall防火墙开放端口
 
firewall -cmd --reload
#重新加载防火墙permanent(永久的)的规则配置,覆盖当前运行时配置,在运行时添加的非permanent规则,都将丢失
 
#开放firewall防火墙端口,需重启防火墙生效service firewalld restart
firewall-cmd --zone=public --add-port=8088/tcp --permanent
# 移除指定端口
firewall-cmd --permanent --remove-port=8088/tcp

命令参数命令含义:

复制代码
-zone #作用域
-add-port=80/tcp #添加端口,格式为:端口 / 通讯协议
-permanent #永久生效,没有此参数重启后失效
相关推荐
七歌杜金房10 小时前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia1 天前
linux curl命令详解_curl详解
linux
扛枪的书生2 天前
Linux 网络管理器用法速查
linux
顺风尿一寸2 天前
Java Socket 内核之旅:从 SocketChannel.read() 到 tcp_recvmsg 与 epoll 的完整调用链路
linux
XIAOHEZIcode2 天前
Ubuntu 终端美化全栈指南:Bash 到 Kitty 踩坑实录
linux·ubuntu·命令行
唐青枫2 天前
别再只会用 cron:Linux systemd Timer 定时任务实战详解
linux
AlfredZhao4 天前
生产环境里,为什么不建议把普通端口直接暴露到公网?
linux·https·443·80
戴为沐5 天前
Linux内存扩容指南
linux
zylyehuo5 天前
Linux 彻底且安全地删除文件
linux
用户805533698036 天前
主线 U-Boot 上 RK3506:和闭源 rkbin 拔河的三个隐性契约
linux·嵌入式