linux 下開放某端口

linux 下開放某端口

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

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

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

        重啓 iptables: service iptables restart

  2、重啓防火牆,這裏有兩種方式重啓防火牆

  a) 重啓後生效
  開啓: chkconfig iptables on
  關閉: chkconfig iptables of

  b) 即時生效,重啓後失效
  開啓: service iptables start
  關閉: service iptables stop




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章