我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉。最近安装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. shell脚本 查看cpu的温度

    一.简介 源码地址 日期:2018/8/24 介绍:查看主板上单个多核CPU中温度最高的一个内核 效果图: 二.使用 适用:centos6+ 语言:英文 注意:需要先安装lm_sensors,不支持虚 ...

  2. 用 WinUI 3 开发了一个摸鱼应用

    1. 开发了一个摸鱼 App 我做了一个简单的 App:摸鱼. 如上图所示,这个 App 就只有一个按钮,点击后假装开始 Windows Update,然后用户就可以光明正大地摸鱼了. 不要小看摸鱼, ...

  3. Matalb 正则表达式预处理数据(一)

    clc clear %% Step 1: 读入数据 phasedata = readtable('phasedata.txt'); %% Step 2: 提取数据 time = phasedata(: ...

  4. .NET 云原生架构师训练营(系统架构)--学习笔记

    目录 对外展现的功能 内部功能 功能交互与价值通路 系统架构 目标 认识系统的价值通路 认识功能架构,通过把功能结构与形式结构结合来描述系统架构 受益原则 好的架构必须使人受益,要想把架构做好,就要专 ...

  5. oracle同义词创建(synonym)

    oracle同义词创建(synonym)   在现在的项目中会有很多接口,数据来源也可能是不同数据库或者是不同的用户下的表,给访问该表带来了一定的麻烦.这个时候就可以使用同义词来简化. 同义词的语法是 ...

  6. 客户通过新型网络访问Web服务

  7. nanogui之更新子模块glfw3.3.2踩坑总结

    nanogui源码下载: A . https://github.com/wjakob/nanogui B . https://github.com/dalerank/nanogui B是fork的A, ...

  8. windows10使用VS(VC++)创建c++多进程命名管道通信

    代码可以在 这里 下载 代码主要涉及到: 管道通信 多线程(含临界区) 多进程通信 创建的子进程独立运行 更新日志: 04-12-2020 1. 去除自定义函数返回值,改为int作为函数返回值并增加相 ...

  9. 【LeetCode】426. Convert Binary Search Tree to Sorted Doubly Linked List 解题报告 (C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客:http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 递归 迭代 日期 题目地址:https://leetc ...

  10. 【LeetCode】1001. Grid Illumination 解题报告(C++)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 目录 题目描述 题目大意 解题方法 哈希 日期 题目地址:https://leetcod ...