我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉。最近安装zabbix ,由于公司服务器既有centos 7又有centos 6,遇到了一些防火墙的问题,现在正好把centos防火墙的问题梳理一下,做一个记录。

开放其他端口同理,只需要把我这里的10050修改为其他需要开放的端口即可。

一、CentOS 7 如果打开了防火墙,需要在firewalld中添加策略,允许访问zabbix-agent端口10050和10051

以下是添加zabbix端口10050和10051端口的命令

[root@localhost~]# firewall-cmd --zone=public --add-port=10050/tcp --permanent

[root@localhost~]# firewall-cmd --zone=public --add-port=10050/udp --permanent

[root@localhost~]# firewall-cmd --zone=public --add-port=10051/tcp --permanent

[root@localhost~]# firewall-cmd --zone=public --add-port=10051/udp --permanent

[root@localhost~]# systemctl restart firewalld

添加后可以在 /etc/firewalld/zones/public.xml这个文件中查看是否添加成功

[root@localhost ~]# vim /etc/firewalld/zones/public.xml

二、CentOS 6 如果打开了防火墙,需要在iptables中添加策略,允许访问zabbix-agent端口10050和10051

编辑iptables,添加以下2行

[root@localhost ~]# vi /etc/sysconfig/iptables

-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050:10051 -j ACCEPT

-A INPUT -m state --state NEW -m udp -p udp --dport 10050:10051 -j ACCEPT

[root@localhost ~]# /etc/init.d/iptables restart

CentOS7 防火墙firewalld 和 CentOS6 防火墙iptables 开放zabbix-agent端口的方法的更多相关文章

  1. CentOS7防火墙firewalld 和 CentOS6防火墙iptables的一些配置命令

    CentOS7 防火墙 一.防火墙的开启.关闭.禁用.查看状态命令 (1)启动防火墙:systemctl start firewalld (2)关闭防火墙:systemctl stop firewal ...

  2. CentOS7使用firewalld打开关闭防火墙与端口(转载)

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld 停止: systemctl disabl ...

  3. 关于学习CentOS7使用firewalld打开关闭防火墙和端口

    1.firewalld简介 firewalld是centos7的一大特点,主要有两个优点:一是支持动态更新,不需要重启服务:二就是加入了防火墙的“zone”概念. firewalld有图形界面和工具界 ...

  4. CentOS7使用firewalld打开关闭防火墙与端口(转)

    CentOS7使用firewalld打开关闭防火墙与端口       1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop ...

  5. 第一篇:动态防火墙firewalld和静态防火墙iptables

    动态防火墙firewalld firewalld提供了一个动态管理的防火墙,它支持网络(network)/防火墙区域(firewall zones )来定义网络连接( network connecti ...

  6. 转 CentOS7使用firewalld打开关闭防火墙与端口

    http://blog.csdn.net/huxu981598436/article/details/54864260 开启端口命令 输入firewall-cmd --query-port=6379/ ...

  7. CentOS7使用firewalld打开关闭防火墙与端口

    1.firewalld的基本使用 启动: systemctl start firewalld 查看状态: systemctl status firewalld  停止: systemctl disab ...

  8. CentOS7 使用firewalld打开关闭防火墙与端口

    1.firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status f ...

  9. CentOS7 使用firewalld打开关闭防火墙以及端口

    1.firewalld的基本使用 启动 systemctl start firewalld 关闭 systemctl stop firewalld 查看状态 systemctl status fire ...

随机推荐

  1. request.getRequestDispatcher()和response.sendRedirect()区别

    一.request.getRequestDispatcher().forward(request,response): 1.属于转发,也是服务器跳转,相当于方法调用,在执行当前文件的过程中转向执行目标 ...

  2. 2.ElasticSearch集群的搭建

    1.创建elasticsearch-cluster文件夹,在内部复制三个elasticsearch服务 2.修改elasticsearch-cluster\node*\config\elasticse ...

  3. 【Git】【Gitee】通过git远程删除仓库文件

    安装Git Git安装配置-菜鸟教程 没有安装下载的,请读者自行安装下载. 启动与初步配置 配置用户名与邮箱 git config --global user.name "用户名" ...

  4. 『与善仁』Appium基础 — 22、获取元素信息的操作(一)

    目录 1.获取元素文本内容 (1)text()方法 (2)get_attribute()方法 (3)综合练习 2.获取元素在屏幕上的坐标 1.获取元素文本内容 (1)text()方法 业务场景: 进入 ...

  5. UE4网络模块解析(一)

    一. UE4网络架构 Server-Client构架 1.一个服务器,一个或多个客户端. 客户端所有的操作如击杀等都需要传到中央服务器来运算,得到的运算结果下发到各个客户端.服务器是UE4多人游戏的重 ...

  6. Mysql配置文件 16c64g优化

    目录 一.说明 二.配置 一.说明 以下配置适合16核64G及以上的配置,会让性能稍微提高1/3左右. 二.配置 my.cnf [client] port = 3306 socket = /usr/l ...

  7. [源码解析] PyTorch 分布式(16) --- 使用异步执行实现批处理 RPC

    [源码解析] PyTorch 分布式(16) --- 使用异步执行实现批处理 RPC 目录 [源码解析] PyTorch 分布式(16) --- 使用异步执行实现批处理 RPC 0x00 摘要 0x0 ...

  8. SpringBoot整合Elasticsearch启动报错处理 nested exception is java.lang.IllegalStateException: availableProcessors is already set to [8], rejecting [8]

    Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean wit ...

  9. window串口之CreateFile打开串口号大于9返回错误ERROR_FILE_NOT_FOUND

    1. 现象 Windows上,串口存在但是打开串口号大于9的串口返回ERROR_FILE_NOT_FOUND,打开小于10的串口号却正常. 2. 解决 以10号串口为例:将错误示范COM10 改为 \ ...

  10. 【LeetCode】172. Factorial Trailing Zeroes 解题报告(Java & Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 递归 循环 日期 题目描述 Given an integer ...