了解优化推广技术相关资讯
在centos 7中,引入了新的防火墙服务firewall,但其依然是构建在iptables基础上的,其关系如下图:
今天分享下firewall的常用管理命令
安装 => [root@zabbix ~]# yum install firewalld 启用 => [root@zabbix ~]# systemctl start firewalld 状态 => [root@zabbix ~]# systemctl status firewalld 禁用 => [root@zabbix ~]# systemctl disable firewalld 停止 => [root@zabbix ~]# systemctl stop firewalld 自启 => [root@zabbix ~]#systemctl enable firewalld.service
添加22端口
[root@zabbix ~]#firewall-cmd --zone=public --add-port=22/tcp --permanent (permanent参数表示永久生效)
删除22端口
[root@zabbix ~]#firewall-cmd --zone= public --remove-port=22/tcp --permanent
ICMP回显打开和关闭(ping)
[root@zabbix ~]#firewall-cmd --permanent --remove-icmp-block=echo-request [root@zabbix ~]#irewall-cmd --permanent --add-icmp-block=echo-request
规则生效
[root@zabbix ~]#firewall-cmd --reload
查看网卡所属区域
[root@zabbix ~]#firewall-cmd --get-zone-of-interface=ens32
查看端口开放列表
查看所有区域的信息
rich rules用于实现更强的功能,如日志syslog和auditd、端口转发、伪装和限制速率等,或者是实现更为详细的允许/限制条件
如开放指定端口给指定的IP
[root@zabbix ~]#firewall-cmd --permanent --add-rich-rule="rule family="ipv4" source address="192.168.3.10" port protocol="tcp" port="22" accept" 即只有192.168.3.10可以访问本地的22端口
后面我们会分享更为详细的rich rules知识
声明:本站发布的内容以原创、转载、分享网络内容为主,如有侵权,请联系电话:021-51697771-8029,邮箱:mj@cndns.com,我们将会在第一时间删除。文章观点不代表本站立场,如需处理请联系我们。