Linux 如何打開端口

舉例:tcp

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

 一、修改/etc/sysconfig/iptables文件,增長以下一行:  rest

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

重啓 iptablesit

service iptables restart
 
 二、重啓防火牆,這裏有兩種方式重啓防火牆   a) 重啓後生效
  開啓: chkconfig iptables on
  關閉: chkconfig iptables off   b) 即時生效,重啓後失效
  開啓: service iptables start
io

  關閉: service iptables stop   table

  三、或者用menu-system-administration-firewall class

       去添加用戶須要的端口。iptables

By the way:service

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

     /usr/sbin/lsof -i 

 

b. telnet ipaddr port

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

相關文章
相關標籤/搜索