CentOS 7 防火墙的系列操作
一、基本操作
firewall-cmd --permanent --add-rule //永久添加规则,需要配合permit参数放行需要放行端口
firewall-cmd --reload // 重载防火墙规则,实时生效
1. firewall-cmd --permanent --remove-rule //永久删除规则,需要配合permit和deny参数
1. firewall-cmd --permanent --add-rule firewall-cmd --permanent --remove-rule
1. firewall-cmd --permanent --add-rule firewall-cmd --permanent --remove-rule 1 permit tcp any any // 添加规则禁止某些端口,其中1是规则号,permit需要配合any参数实现
二、高级操作
netstat -tuln
1. 修改/etc/sysconfig/iptables规则,并使其永久生效
2. firewall-cmd --permanent --zone=public --add-service=webserver // 添加HTTP服务
3. firewall-cmd --zone=public --remove-service=webserver // 删除HTTP服务
#查看本地网络接口信息
ip link show
#查看路由表
ip route
#查看本地服务列表
领取专属 10元无门槛券
手把手带您无忧上云