Centos7防火墙关闭和启用iptables操作

星期三, 2015-12-09 | Author: Lee | linux | 3,409 views

前序 还是docker惹得最近做的系统都是上的centos7的系统带来的一系列的新环境的适应

补记下:在使用oracle vmbox虚拟centos7的时候 选用桥接网络的时候一定要记得插网线,无线不好使(浪费了一上午的时间的教训)
可以做到内外网互通等,否则只能部分的网段想通 且 无法获取外网
具体ip指令 为 ip add
关于静态ip设置见 centos6.4静态ip设置于eth1的问题 依旧好用

回到防火墙问题:(起因装好后直接ssh访问被拒绝)

CentOS7这个版本的防火墙默认使用的是firewall,与之前的版本使用iptables不一样,按如下方便配置防火墙:

1.关闭防火墙:sudo systemctl stop firewalld.service

2. 关闭开机启动:sudo systemctl disable firewalld.service

3.安装iptables防火墙

执行以下命令安装iptables防火墙:sudo yum install iptables-services

4.配置iptables防火墙,打开指定端口(具体跟以前版本一样,网上介绍很多,这里不多介绍了)

5. 设置iptables防火墙开机启动:sudo systemctl enable iptables

Tags: ,

文章作者: Lee

本文地址: https://www.pomelolee.com/1525.html

除非注明,Pomelo Lee文章均为原创,转载请以链接形式标明本文地址

2 Comments to Centos7防火墙关闭和启用iptables操作

Lee
2015 年 12 月 09 日

除了防火墙还需要关闭selinx功能: /etc/sysconfig/selinux 中 追加 SELINUX=disabled

Lee
2015 年 12 月 10 日

在补充一个是 添加服务启动 /etc/rc.local 时候要给 /etc/rc.d/rc.local 加个可执行权限 chmod +x /etc/rc.d/rc.local即可

Leave a comment

Search

文章分类

Links

Meta