Linux 如何打開端口


舉例:

 開放10000端口的解決步驟如下: 

 1、修改/etc/sysconfig/iptables文件,增加如下一行:  

 -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 10000 -j ACCEPT

重啟 iptables

service iptables restart
 
 2、重啟防火牆,這里有兩種方式重啟防火牆   a) 重啟后生效
  開啟: chkconfig iptables on
  關閉: chkconfig iptables off   b) 即時生效,重啟后失效
  開啟: service iptables start

  關閉: service iptables stop   

  3、或者用menu-system-administration-firewall 

       去添加用戶需要的端口。

By the way:

 a.  netstat -tanp 去顯示端口狀態。

     /usr/sbin/lsof -i 

 

b. telnet ipaddr port

    to check if ip and port is available before making connection. 

 


免責聲明!

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



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