仙人掌中的SNMP检测不到服务器

登录有问题的服务器
1.检测snmp

localhost:~ # ps -ef|grep snmp

root 55180 1 0 08:37 ? 00:00:08 /usr/sbin/snmpd -r -A -LF n /var/log/net-snmpd.log -p /var/run/snmpd.pid

root 58436 53989 0 09:44 pts/0 00:00:00 grep --color=auto snmp
2.检测端口

localhost:~ # netstat -nlup|grep 161

udp 0 0 0.0.0.0:161 0.0.0.0:* 55180/snmpd
3.查看连接

localhost:~ # netstat -anp|grep snmpd

tcp 0 0 127.0.0.1:199 0.0.0.0:* LISTEN 55180/snmpd

udp 0 0 0.0.0.0:161 0.0.0.0:* 55180/snmpd
4.检测防火墙SuSEfirewall2

localhost:~ # systemctl status SuSEfirewall2

Unit SuSEfirewall2.service could not be found.
5.查看防火墙进程

localhost:~ # ps -ef |grep fire

root 55442 1 0 08:51 ? 00:00:00 /usr/bin/python3 /usr/sbin/firewalld --nofork --nopid

root 55524 55352 0 09:08 pts/0 00:00:00 grep --color=auto fire

原来使用了firewalld服务,查看策略

localhost:~ # firewall-cmd --list-all

public (active)

target: default

icmp-block-inversion: no

interfaces: eth0

sources:

services: dhcpv6-client ssh

ports: 80/tcp 22/tcp 161/tcp

protocols:

forward: no

masquerade: no

forward-ports:

source-ports:

icmp-blocks:

rich rules:

原因在于后来加的防火墙策略中端口设置错误,snmp使用UDP
6.添加防火墙策略

localhost:~ # firewall-cmd --add-port=161/udp --permanent

success
7.重启防火墙

localhost:~ # systemctl restart firewalld
8.客户端使用snmpwalk检测

root@Cnyunwei \~\]# snmpwalk -v 2c -c mygroup 192.168.10.20 可以看到可以仙人掌中服务器的snmp服务正常了。 注:如果使用SuSEfirewall2,需要修改 /etc/sysconfig/中的配置然后重新启动。 FW_SERVICES_EXT_UDP="161" systemctl restart SuSEfirewall2

相关推荐
爱吃橘子橙子柚子3 天前
3CPU性能排查总结(超详细)【Linux性能优化】
运维·cpu
舒一笑4 天前
程序员效率神器:一文掌握 tmux(服务器开发必备工具)
运维·后端·程序员
NineData5 天前
数据库管理工具NineData,一年进化成为数万+开发者的首选数据库工具?
运维·数据结构·数据库
梦想很大很大5 天前
拒绝“盲猜式”调优:在 Go Gin 项目中落地 OpenTelemetry 链路追踪
运维·后端·go
Sinclair5 天前
内网服务器离线安装 Nginx+PHP+MySQL 的方法
运维
叶落阁主5 天前
Tailscale 完全指南:从入门到私有 DERP 部署
运维·安全·远程工作
茶杯梦轩6 天前
从零起步学习RabbitMQ || 第二章:RabbitMQ 深入理解概念 Producer、Consumer、Exchange、Queue 与企业实战案例
服务器·后端·消息队列
甲鱼9297 天前
MySQL 实战手记:日志管理与主从复制搭建全指南
运维
YuMiao8 天前
gstatic连接问题导致Google Gemini / Studio页面乱码或图标缺失问题
服务器·网络协议
碳基沙盒9 天前
OpenClaw 多 Agent 配置实战指南
运维