【Linux】- CentOS 防火墙iptables和firewall
2018-10-12 15:02
776 查看
1 iptables防火墙
1.1 基本操作
# 查看防火墙状态 service iptables status
# 停止防火墙 service iptables stop
# 启动防火墙 service iptables start
# 重启防火墙 service iptables restart
# 永久关闭防火墙 chkconfig iptables off
# 永久关闭后重启 chkconfig iptables on
1.2 查看防火墙状态
发现只有22端口开放。
1.3 开启端口
vim /etc/sysconfig/iptables # 加入如下代码 -A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
保存并重启iptables,再次查看状态:
多了80端口。
2 firewall防火墙
2.1 查看firewall服务状态
systemctl status firewalld
2.2 查看firewall的状态
firewall-cmd --state
2.3 开启、重启、关闭firewall
# 开启 service firewalld start # 重启 service firewalld restart # 关闭 service firewalld stop
2.4 查看防火墙规则
firewall-cmd --list-all
2.5 查询、开放、关闭端口
# 查询端口是否开放 firewall-cmd --query-port=3306/tcp # 开放80端口 firewall-cmd --permanent --add-port=3306/tcp # 移除端口 firewall-cmd --permanent --remove-port=3306/tcp
2.6 重启防火墙
firewall-cmd --reload
2.7 参数解释
1、firwall-cmd:是Linux提供的操作firewall的一个工具; 2、--permanent:表示设置为持久; 3、--add-port:标识添加的端口;
相关文章推荐
- CentOS 7.X默认firewall防火墙改为iptables防火墙
- CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙
- centos 7 防火墙设置 使用 iptables firewall-cmd 开放端口号
- CentOS 7.0关闭默认firewall防火墙启用iptables防火墙
- CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙。
- centos中iptables和firewall防火墙开启、关闭、查看状态、基本设置等
- CentOS Linux iptables 防火墙
- CentOS 7 关闭防火墙(firewall)并安装iptables防火墙
- 【Linux】CentOS 7通过Firewall开放防火墙端口
- centos中iptables和firewall防火墙开启、关闭、查看状态、基本设置等
- centos7 关闭firewall防火墙指令以及更换安装iptables并配置
- CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙,配置apache
- CentOS 5 Linux iptables防火墙的配置
- LINUX防火墙firewall、iptables
- CentOS 7 下 安装Webmin 启动防火墙失败----Applying firewall rules:iptables-restore:line 2 failed
- Linux(CentOS)下,防火墙iptables配置
- linux设置iptables防火墙的详细步骤(centos防火墙设置方法)
- CentOS下配置iptables防火墙 linux NAT(iptables)配置
- Red hat Linux内置防火墙软件iptables---子链RH-Firewall-1-INPUT
- 玩转Linux之- CentOS 7.0,启用iptables防火墙