操作系统环境:CentOS Linux release 7.0.1406(Core) 64位 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙步骤。 1、关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running) 2、iptables防火墙(这里iptables已经安装,下面进行配置) vi/etc/sysconfig/iptables #编辑防火墙配置文件 # sampleconfiguration for iptables service # you can edit thismanually or use system-config-firewall # please do not askus 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 -jACCEPT -A INPUT -i lo -jACCEPT -A INPUT -p tcp -mstate --state NEW -m tcp --dport 22 -j ACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 80 -jACCEPT -A INPUT -p tcp -m state --state NEW -m tcp --dport 8080-j ACCEPT -A INPUT -j REJECT--reject-with icmp-host-prohibited -A FORWARD -jREJECT --reject-with icmp-host-prohibited COMMIT :wq! #保存退出 备注:这里使用80和8080端口为例。***部分一般添加到“-A INPUT -p tcp -m state --state NEW -m tcp--dport 22 -j ACCEPT”行的上面或者下面,切记不要添加到最后一行,否则防火墙重启后不生效。 systemctlrestart iptables.service #最后重启防火墙使配置生效 systemctlenable iptables.service #设置防火墙开机启动 全文完.......... --------------------------------------分割线 -------------------------------------- iptables使用范例详解 http://www.linuxidc.com/Linux/2014-03/99159.htm iptables—包过滤(网络层)防火墙 http://www.linuxidc.com/Linux/2013-08/88423.htm Linux防火墙iptables详细教程 http://www.linuxidc.com/Linux/2013-07/87045.htm iptables+L7+Squid实现完善的软件防火墙 http://www.linuxidc.com/Linux/2013-05/84802.htm iptables的备份、恢复及防火墙脚本的基本使用 http://www.linuxidc.com/Linux/2013-08/88535.htm Linux下防火墙iptables用法规则详解 http://www.linuxidc.com/Linux/2012-08/67952.htm --------------------------------------分割线 --------------------------------------
相关推荐
CentOS 7.0关闭默认防火墙启用iptables防火墙.docx
主要介绍了CentOS 7.0关闭默认防火墙启用iptables防火墙的设置方法,需要的朋友可以参考下
首先,由于 CentOS 7.0 默认使用 firewallD,所以在启用 iptables 之前,我们需要关闭 firewallD 服务。这可以通过以下两条命令完成: 1. `systemctl stop firewalld.service` - 此命令会立即停止 firewallD 服务。...
此外,我们还可以使用 CentOS 7.0 关闭默认防火墙启用 iptables 防火墙。 在优化 iptables 的性能时,我们需要注意的是,不要根据规章将规章分到一个组,而要以匹配元素为分组基准。这是因为匹配元素的数量是固定的...
CentOS 7.0默认使用firewall,但我们将切换到iptables。执行以下命令关闭并禁用firewall: ```bash systemctl stop firewalld.service systemctl disable firewalld.service ``` 安装iptables服务,并编辑...
- **关闭默认防火墙并启用iptables:** - 停止并禁用firewall服务。 - 安装iptables服务,并配置规则以允许必要的端口,如HTTP(80)、MySQL(3306)等。 - 关闭SELINUX,以避免安全策略限制导致的问题。 - **软件源...
在本篇"CentOS服务器部署指南1"中,我们将探讨如何在CentOS操作系统上进行基本的服务器配置,包括防火墙设置、软件安装以及关键服务的启用。以下是对这些步骤的详细说明: 首先,我们来讨论防火墙设置。在CentOS中...
CentOS 7使用firewalld,需要关闭firewalld并启用iptables,开放873端口以允许Rsync通信。 **二、Sersync配置(源服务器)** Sersync是一款针对Linux系统的实时增量文件同步工具,可以实现文件的实时监控和同步。...
4. **重启并启用iptables服务**: ```bash systemctl restart iptables.service systemctl enable iptables.service ``` #### 五、安装ZooKeeper集群 1. **解压ZooKeeper**: ```bash tar -zxvf zookeeper-...