CentOS7 開啟端口和查看指定端口是否開啟

CentOS 7 默認沒有使用 iptables,所以通過編輯 iptables 的配置文件來開啟端口是不可以的

CentOS7 采用了 firewalld 防火墻

查看80端口是否開啟
firewall-cmd --query-port=80/tcp
開啟80端口
firewall-cmd --add-port=80/tcp --permanent   # --permanent 永久生效,沒有此參數重啟后失效
關閉80端口
firewall-cmd --remove-port=80/tcp --permanent   # --permanent 永久生效,沒有此參數重啟后失效

firewalld 基本使用
啟動: systemctl start firewalld
查看狀態: systemctl status firewalld
停止: systemctl disable firewalld
禁用: systemctl stop firewalld

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容