您的位置:首页 > 运维架构 > Linux

CentOS 配置防火墙操作实例

2015-09-02 00:06 791 查看
http://my.oschina.net/u/593517/blog/297941

CentOS 配置防火墙操作实例(启、停、开、闭端口): 注:防火墙的基本操作命令:查询防火墙状态:[root@localhost ~]# service iptables status<回车>停止防火墙:[root@localhost ~]# service iptables stop <回车>启动防火墙:[root@localhost ~]# service iptables start <回车>重启防火墙:[root@localhost ~]# service iptables restart <回车>永久关闭防火墙:[root@localhost ~]# chkconfig iptables off<回车>永久关闭后启用:[root@localhost ~]# chkconfig iptables on<回车>

用编辑器打开/etc/sysconfig/iptables ,添加端口
# 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: