我们在生产环境中,一般都是把防火墙打开的,不像测试环境,可以直接关闭掉。最近安装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. MySQL——基础查询与条件查询

    基础查询 /* 语法: select 查询列表 from 表名; 类似于:System.out.println(打印东西); 1.查询列表可以是:表中的字段.常量值.表达式.函数 2.查询的结果是一个 ...

  2. IO中同步异步,阻塞与非阻塞 -- 通俗篇

    一.同步与异步 同步/异步, 它们是消息的通知机制 1. 概念解释 A. 同步 所谓同步,就是在发出一个功能调用时,在没有得到结果之前,该调用就不返回. 按照这个定义,其实绝大多数函数都是同步调用(例 ...

  3. 虚拟机+OS系统安装+Xshell

    安装虚拟机 1.先下载好VMware Workstation.exe的安装包(最好直接下载破解版(非最新版) 在此私人网址不公布 可直接百度 资源很多) 2.直接下一步 直到安装完成(注意最好不要装在 ...

  4. LuoguP7870 「Wdoi-4」兔已着陆 题解

    Content 对一个栈执行如下操作: 1 l r:依次向栈里面弹入 \(l,l+1,\dots,r-1,r\). 2 k:依次从栈里面弹出 \(k\) 个数,并求出所有弹出的数的和. 数据范围:\( ...

  5. CF1292B Aroma's Search 题解

    Content 给定一个坐标系,已知第一个点的坐标为 \((x_0,y_0)\),第 \(i(i>0)\) 个点的坐标满足这样的两个递推式:\(x_i=a_xx_{i-1}+b_x,y_i=a_ ...

  6. 常用故障排查监控shell脚本

    #!/bin/bash #ping_monitor.sh IP_ADDRESS=$1 if [ -n "$IP_ADDRESS" ] ; then while : do PING_ ...

  7. libevent源码学习(6):事件处理基础——event_base的创建

    目录前言创建默认的event_baseevent_base的配置event_config结构体创建自定义event_base--event_base_new_with_config禁用(避免使用)某一 ...

  8. nim_duilib(2)之xml目录结构理解

    introduction 本文将总结我对nim_duilib的xml配置. 更多控件和控件属性的具体说明, 请参考 here before starting 1 You should clone th ...

  9. 【LeetCode】55. Jump Game 解题报告(Python & C++)

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

  10. 【LeetCode】368. Largest Divisible Subset 解题报告(Python)

    作者: 负雪明烛 id: fuxuemingzhu 个人博客: http://fuxuemingzhu.cn/ 题目地址:https://leetcode.com/problems/largest-d ...