本文共 1067 字,大约阅读时间需要 3 分钟。
http://my.oschina.net/u/593517/blog/297941
CentOS 配置防火墙操作实例(启、停、开、闭端口):
注:防火墙的基本操作命令:
查询防火墙状态:
[root ~]# service iptables status<回车>
停止防火墙:
[root ~]# service iptables stop <回车>
启动防火墙:
[root ~]# service iptables start <回车>
重启防火墙:
[root ~]# service iptables restart <回车>
永久关闭防火墙:
[root ~]# chkconfig iptables off<回车>
永久关闭后启用:
[root@localhost ~]# chkconfig iptables on<回车>
用编辑器打开/etc/sysconfig/iptables ,添加端口
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # sample configuration for iptables service # you can edit this manually or use system-config-firewall # please do not ask us to add additional ports/services to this default configuration *filter :INPUT ACCEPT [0:0] :FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -A INPUT -p icmp -j ACCEPT -A INPUT -i lo -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited COMMIT |