linux开启端口

目录

1.查看防火墙状态

[1.1 开启防火墙](#1.1 开启防火墙)

[1.2 再次查看防火墙状态](#1.2 再次查看防火墙状态)

2.开启指定端口

[3. 重启防火墙](#3. 重启防火墙)

4.重新加载防火墙

5.查看已经开启的端口


1.查看防火墙状态

复制代码
firewall-cmd --state

如果返回的是 not running,那么需要先开启防火墙,

1.1 开启防火墙

复制代码
systemctl start firewalld.service

1.2 再次查看防火墙状态

复制代码
firewall-cmd --state

已经开启。

2.开启指定端口

复制代码
firewall-cmd --zone=public --add-port=8080/tcp --permanent

显示 success 则表示成功.

3. 重启防火墙

开启端口之后需要重启一下防火墙。

复制代码
systemctl restart firewalld.service

没有任何提示则表示成功

4.重新加载防火墙

复制代码
firewall-cmd --reload

5.查看已经开启的端口

复制代码
irewall-cmd --list-ports
相关推荐
你好潘先生6 小时前
别再记命令了,用 yeero do 说句人话就能跑脚本,而且不烧 token
服务器·python·命令行
orion5717 小时前
Missing Semester Class1:course overview and introduction of shell
linux
用户120487221611 天前
Linux驱动编译与加载
linux·嵌入式
程序员老赵1 天前
服务器文件不想 SFTP 上传?Docker 跑个 File Browser,浏览器就能管理
服务器·docker·开源
vivo互联网技术1 天前
从 10 分钟到 1 秒:ES 深度分页任意跳页的三轮优化实战
服务器·数据库·redis·elasticsearch·深度分页
用户805533698031 天前
Input 子系统架构:Core、Handler、Driver 三层是怎么协作的
linux·嵌入式
用户805533698031 天前
RK-Forge外设系列开篇 - 把板子从「能启动」变成「能用」:Ethernet/SPI/MMC 三个纯接线外设
linux·github·嵌入式
七歌杜金房2 天前
我终于又有了自己的 Linux 电脑
linux·debian·mac
tntxia3 天前
linux curl命令详解_curl详解
linux