惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Martin Fowler
Martin Fowler
Microsoft Security Blog
Microsoft Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Vercel News
Vercel News
Y
Y Combinator Blog
D
DataBreaches.Net
IT之家
IT之家
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园_首页
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
WordPress大学
WordPress大学
H
Help Net Security
GbyAI
GbyAI
C
Check Point Blog
L
LangChain Blog
小众软件
小众软件
T
The Blog of Author Tim Ferriss
MyScale Blog
MyScale Blog
G
Google Developers Blog
月光博客
月光博客
V
V2EX
M
MIT News - Artificial intelligence
博客园 - 叶小钗

清江 林影 – 魔帆博客

Linux Tomcat 开机启动 | 魔帆博客 如何修改linux系统主机名称 | 魔帆博客 Google Docker 初探 | 魔帆博客 尘 埃 | 魔帆博客 倦 | 魔帆博客 荷塘 | 魔帆博客 无题 | 魔帆博客 闲想 | 魔帆博客 月光下的玫瑰 | 魔帆博客 清晨的小鸟 | 魔帆博客 矛盾 | 魔帆博客 雨夜 | 魔帆博客 竹林幻梦 | 魔帆博客 因为认识了你 | 魔帆博客 爱情打油诗 | 魔帆博客
CentOS 7.0关闭默认防火墙启用iptables防火墙 | 魔帆博客
清江 林影 · 2017-08-15 · via 清江 林影 – 魔帆博客

1、关闭firewall:

停止firewall

systemctl stop firewalld.service

禁止firewall开机启动

systemctl disable firewalld.service

查看默认防火墙状态(关闭后显示notrunning,开启后显示running)

firewall-cmd --state

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