最新消息:非无江海志,潇洒送日月

关闭或开启Linux上的iptables防火墙中的端口

网站建设 江海志 5608浏览 0评论

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

重起iptalbes服务:service
iptables restart

转载请注明:江海志の博客 » 关闭或开启Linux上的iptables防火墙中的端口

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址