Centos7防火墙
来源:互联网 发布:物业网络拓扑图 编辑:程序博客网 时间:2024/05/22 15:45
操作系统环境: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 #设置防火墙开机启动
- CentOS7防火墙
- centos7 防火墙
- centos7 防火墙
- CentOS7防火墙
- centos7防火墙
- CentOS7防火墙
- centos7防火墙
- centos7防火墙
- Centos7防火墙
- CentOS7 防火墙
- centos7 防火墙
- Centos7防火墙
- centos7 防火墙
- Centos7防火墙
- Centos7防火墙
- centos7如何关闭防火墙!
- centos7 关闭防火墙
- centos7 安装iptables防火墙
- TF-IDF与余弦相似性的应用(三):自动摘要
- 驱动框架
- java基础复习七:数组的声明与扩容
- java中类测试总结
- String hashCode() 设计的道理
- Centos7防火墙
- 对webmagic的一个example进行Debug——框架执行流程
- java IO学习
- spring对dao层的支持(datasource的作用)
- Linux操作系统与实训教程(习题2)
- codeforces 148D Bag of mice (概率)
- JFinal神器的配置
- 一行一行读Java源码——ArrayList
- 数据结构实验之图论三:判断可达性