1、 永久性生效,重启后不会复原
开启: chkconfig iptables on
关闭: chkconfig iptables off
2、即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
3、若不想关闭防火墙,可做如下设置,开启相关端口,
编辑/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
开启: chkconfig iptables on
关闭: chkconfig iptables off
2、即时生效,重启后复原
开启: service iptables start
关闭: service iptables stop
3、若不想关闭防火墙,可做如下设置,开启相关端口,
编辑/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
本文介绍了iptables的基本操作,包括如何永久性和即时性地启动或关闭防火墙,以及如何通过编辑配置文件来开放特定端口的方法。
2921

被折叠的 条评论
为什么被折叠?



