2013年1月4日 星期五

【轉載】centos防火牆設定方法(開啟指定Port)


來自:http://blog.faq-book.com/?p=68

* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★

一.登入主機

二. 開啟防火牆

三.CentOS 防火牆打開22,25,80,22,1433,3306端口操作




(FTP):

/sbin/iptables -I INPUT -p tcp --dport 21 -j ACCEPT

(SSH):

/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

(SMTP)

/sbin/iptables -I INPUT -p tcp --dport 25 -j ACCEPT

(HTTP)

/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT

(MSSQL)

/sbin/iptables -I INPUT -p tcp --dport 1433 -j ACCEPT

(MYSQL)

/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT



指定ip

/sbin/iptables -I INPUT -p tcp -s IP --dport 21 -j ACCEPT

(添加在倒数第二行之前,不然等於沒添加)

四.然後存檔:

/etc/rc.d/init.d/iptables save



五.查看有打開的PORT:

/etc/init.d/iptables status

netstat -tnlp

netstat -tlp



六.重啟防火牆

/etc/init.d/iptables restart



七.會寫入到這邊 若要關PORT到這邊#

/etc/sysconfig/iptables



永久關閉 (沒事別用)

chkconfig –level 35 iptables off


* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★* , + ˇ★

沒有留言:

張貼留言