查看所有端口占用
使用ss命令即可
查看一個端口的進程佔用情況
使用ss -lpn src :[port]
命令。[port]換成端口號
開放/關閉端口
使用firewall-cmd --zone=public --add-port=[port]/tcp --permanent
命令開放指定端口,[port]換成端口號
使用firewall-cmd --remove-port=[port]/udp --permanent
命令關閉指定端口,[port]換成端口號
這兩個命令的端口後面可以指定協議,最後的–permanent表示永久生效,使用完命令後要重啓防火牆firewall-cmd --reload