CentOS 7.0,启用iptables防火墙

本文涉及的产品
云防火墙,500元 1000GB
简介: CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。1、关闭firewall:systemctl stop firewalld.service #停止firewallsystemctl disable firewalld.
CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
1、关闭firewall:
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
2、安装iptables防火墙
yum install iptables-services #安装
vi /etc/sysconfig/iptables #编辑防火墙配置文件
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
:wq! #保存退出
systemctl restart iptables.service #最后重启防火墙使配置生效
systemctl enable iptables.service #设置防火墙开机启动
若转载请注明出处!若有疑问,请回复交流!
目录
相关文章
|
13天前
|
机器学习/深度学习 安全 网络协议
Linux防火墙iptables命令管理入门
本文介绍了关于Linux防火墙iptables命令管理入门的教程,涵盖了iptables的基本概念、语法格式、常用参数、基础查询操作以及链和规则管理等内容。
173 73
|
1月前
|
存储 网络协议 Ubuntu
如何在 Ubuntu 14.04 上使用 Iptables 实现基本防火墙模板
如何在 Ubuntu 14.04 上使用 Iptables 实现基本防火墙模板
25 0
|
1月前
|
网络协议 Ubuntu Linux
Iptables 防火墙的工作原理
Iptables 防火墙的工作原理
17 0
|
4月前
|
XML 安全 Linux
【Linux】深入探究CentOS防火墙(Firewalld):基础概念、常用命令及实例操作
【Linux】深入探究CentOS防火墙(Firewalld):基础概念、常用命令及实例操作
|
4月前
|
Linux 网络安全
centos7如何关闭防火墙
centos7如何关闭防火墙
439 3
|
4月前
|
网络协议 Linux 网络安全
iptables 与 firewalld 防火墙
iptables 与 firewalld 防火墙
|
4月前
|
网络协议 Linux 网络安全
CentOS 7 防火墙指令
本文介绍了CentOS 7中管理防火墙`firewalld`的指令。
69 0
|
4月前
|
网络协议 Linux 网络安全
Linux(17)Centos5、6、7、8版本的防火墙常用命令
Linux(17)Centos5、6、7、8版本的防火墙常用命令
85 0
|
24天前
|
安全 Linux 应用服务中间件
在Linux中,包过滤防火墙与代理应用防火墙有什么区别?有哪些相应的产品?
在Linux中,包过滤防火墙与代理应用防火墙有什么区别?有哪些相应的产品?
|
18天前
|
Linux 网络安全
linux关闭方防火墙的命令
linux关闭方防火墙的命令
31 2