论坛首页 综合技术论坛

关闭或开启Linux上的防火墙

浏览 12960 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-12-18   最后修改:2008-12-18

关闭

/etc/rc.d/init.d/iptables stop

开启

/etc/rc.d/init.d/iptables start

查看当前配置:iptables -L

 

redhat :
chkconfig --level 2345 iptables off
service iptables stop
但是不推荐关闭防火墙
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

论坛首页 综合技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics