1.lsof
(1).查看端口对应的进程号

lsof

2.netstat
(1).根据进程号查看对应的端口信息

netstat -anop | grep

3.防火墙
(1).开启防火墙

systemctl start firewalld

(2).开放指定端口

firewall-cmd --zone=public --add-port=8080/tcp --permanent

–zone=public:作用域
–add-port=8080/tcp:添加端口,格式为端口/通讯协议
–permanent:永久生效,没有此参数重启后失效

(3).重启防火墙

firewall-cmd --reload

(4).查看当前所有tcp端口

netstat
firewall-cmd --list-port