目录
CentOS7默认的防火墙不是iptables,而是firewalle.
CentOS7默认的防火墙不是iptables,而是firewalle.
Centos 7 firewall 命令:
查看已经开放的端口:
firewall-cmd --list-ports
开启端口 (CentOS7下添加防火墙例外端口,即使用firewalle)
firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --reload #重新加载策略配置,以使新配置生效
命令含义:
–zone #作用域
–add-port=80/tcp #添加端口,格式为:端口/通讯协议
–permanent #永久生效,没有此参数重启后失效
防火墙设置
//查看状态
service firewalld status
//重启firewall
firewall-cmd --reload
//停止firewall
systemctl stop firewalld.service
//禁止firewall开机启动
systemctl disable firewalld.service
Centos 7 使用iptables:
禁用/停止自带的firewalld服务
//临时关闭
systemctl stop firewalld
//禁止开机启动
systemctl disable firewalld
//禁用firewalld服务
systemctl mask firewalld
安装iptable iptable-service
//先检查是否安装了iptables
service iptables status
//安装iptables
yum install -y iptables
//升级iptab