CentOS 防火牆

偶然看到防火牆的配置操作說明,感覺不錯。執行”setup”命令啓動文字模式配置實用程序,在”選擇一種工具”中選擇”防火牆配置”,然後選擇”運行工具”按鈕,出現防火牆配置界面,將”安全級別”設爲”禁用”,然後選擇”確定”即可.

或者用命令:
#/sbin/iptables -I INPUT -p tcp –dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp –dport 22 -j ACCEPT
#/etc/rc.d/init.d/iptables save

 

這樣重啓計算機後,防火牆默認已經開放了80和22端口

這裏應該也可以不重啓計算機:
#/etc/init.d/iptables restart

防火牆的關閉,關閉其服務即可:

查看防火牆信息:
#/etc/init.d/iptables status

關閉防火牆服務:
#/etc/init.d/iptables stop

永久關閉?不知道怎麼個永久法:
#chkconfig –level 35 iptables off

 

看了好幾個頁面內容都有錯,下面是正確方法:
#/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT
#/sbin/iptables -I INPUT -p tcp --dport 22 -j ACCEPT

然後保存:
#/etc/rc.d/init.d/iptables save

再查看是否已經有了:
[root@vcentos ~]# /etc/init.d/iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination   
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:80
2 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
3 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0   
 
Chain FORWARD (policy ACCEPT)
num target prot opt source destination   
1 RH-Firewall-1-INPUT all -- 0.0.0.0/0 0.0.0.0/0
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章