首页 > 系统服务 > 详细

Linux下查看、关闭及开启防火墙命令

时间:2018-07-01 19:26:39      阅读:228      评论:0      收藏:0      [点我收藏+]
Linux下查看、关闭及开启防火墙命令

1)永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off
2)即时生效,重启后失效
开启: service iptables start
关闭: service iptables stop
需要说明的是对于Linux下的其它服务都可以用以上命令执行开启和关闭操作。
在开启了防火墙时,做如下设置,开启相关端口, 修改/etc/sysconfig/iptables 文件,添加以下内容:
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
3)查看防火墙状态
chkconfig iptables --list
注意:在Redhat 6.5之前的版本,需要禁止libvirted服务,因为libvirted服务会开机调起防火墙。命令如下:
chkconfig libvirted off

Linux下查看、关闭及开启防火墙命令

原文:http://blog.51cto.com/12942223/2134781

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!