在zone内设置规则
基本规则配置
把服务,端口,协议加入到某个zone内
添加服务
firewall -cmd --permanent --add-service=http --zone=home
把http服务放到home里面
移除服务
firewall -cmd --permanent --remove-service=http --zone=home
添加端口(添加端口的时候一定要注意添加协议)
firewall -cmd --permanent --add-port-=80/tcp --zone=home
移除端口
firewall -cmd --permanent --remove-port-=80/tcp --zone=home -per
协议不能乱添加,因为假如添加了一个tcp协议进来,那么所有的tcp相关联的协议都能够进来
添加协议的方法
firewall -cmd --permanent --add-portocol-=tcp --zone=home -per
target:默认处理动作,如果一个数据包在整个zone内没有找到规则,那么就会有一些默认处理方式
1.ACCEPT :允许
2.DROP:直接丢弃,没有回应
3.REJECT:拒绝,会有一个ICMP报文相应
4.default:继续用默认zone匹配规则