zoukankan      html  css  js  c++  java
  • CentOS7 防火墙firewalld 和 CentOS6 防火墙iptables 开放zabbix-agent端口的方法

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

  • 相关阅读:
    IntelliJ IDEA 使用总结[zz]
    “vmware tools 只能虚拟机中安装”的解决方法
    Git 少用 Pull 多用 Fetch 和 Merge
    hypervisor与VMware共存方法
    rsa && sha1 js code
    PHP导出数据库方法
    Git中的AutoCRLF与SafeCRLF换行符问题
    DOTA2参数收集
    HelloGitHub.com 网站开源了
    第 10 篇 评论接口
  • 原文地址:https://www.cnblogs.com/patrick-yeh/p/12966333.html
Copyright © 2011-2022 走看看