centos7 安裝成功后,只能訪問22端口,其他都不能訪問的問題


centos7安裝后,端口只能訪問22,telnet也只能連通22端口,其他端口都不能訪問,防火牆關閉也不行。

症狀詳情:新安裝的centos7系統,在8081上部署Apache的web服務,服務正常啟動,用curl命令可以localhost本地訪問,也可以用ip加端口的方式訪問,但是外網無法訪問,telnet不通端口。

解決: 查看當前開放端口     /sbin/iptables -L -n,

添加端口:vi /etc/sysconfig/iptables

重啟防火牆:/sbin/service iptables restart

RedHat系統

查看RedHat系統版本 cat /etc/redhat -release

啟動: systemctl start firewalld
查看狀態: systemctl status firewalld 
停止: systemctl disable firewalld
禁用: systemctl stop firewalld
啟動服務:systemctl start firewalld.service
關閉服務:systemctl stop firewalld.service
重啟服務:systemctl restart firewalld.service
服務的狀態:systemctl status firewalld.service
在開機時啟用一個服務:systemctl enable firewalld.service
在開機時禁用一個服務:systemctl disable firewalld.service
查看服務是否開機啟動:systemctl is-enabled firewalld.service
查看已啟動的服務列表:systemctl list-unit-files|grep enabled
查看啟動失敗的服務列表:systemctl --failed
查看版本: firewall-cmd --version
查看幫助: firewall-cmd --help
顯示狀態: firewall-cmd --state
查看所有打開的端口: firewall-cmd --zone=public --list-ports
更新防火牆規則: firewall-cmd --reload
查看區域信息:  firewall-cmd --get-active-zones
查看指定接口所屬區域: firewall-cmd --get-zone-of-interface=eth0
拒絕所有包:firewall-cmd --panic-on
取消拒絕狀態: firewall-cmd --panic-off
查看是否拒絕: firewall-cmd --query-panic


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM