用命令行方式关闭CentOS防火墙

在防火墙中开放端口80和端口22的方法如下:

#/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 status                ## 查看防火墙状态
#/etc/init.d/iptable stop                    ## 本次关闭防火墙
#/etc/init.d/iptable restart                ## 重启防火墙
永久性关闭防火墙:

#chkconfig --level 35 iptables off   ## 注意中间的是两个英式小短线;

#shutdown -r now                     ##重启

posted on 2020-01-26 22:47  阿安安  阅读(1919)  评论(0编辑  收藏  举报