仙人掌中的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

相关推荐
Sinclair14 小时前
简单几步,安卓手机秒变服务器,安装 CMS 程序
android·服务器
Rockbean2 天前
用40行代码搭建自己的无服务器OCR
服务器·python·deepseek
蝎子莱莱爱打怪2 天前
Centos7中一键安装K8s集群以及Rancher安装记录
运维·后端·kubernetes
茶杯梦轩2 天前
CompletableFuture 在 项目实战 中 创建异步任务 的核心优势及使用场景
服务器·后端·面试
海天鹰2 天前
【免费】PHP主机=域名+解析+主机
服务器
DianSan_ERP2 天前
电商API接口全链路监控:构建坚不可摧的线上运维防线
大数据·运维·网络·人工智能·git·servlet
呉師傅2 天前
火狐浏览器报错配置文件缺失如何解决#操作技巧#
运维·网络·windows·电脑
不是二师兄的八戒2 天前
Linux服务器挂载OSS存储的完整实践指南
linux·运维·服务器
芝士雪豹只抽瑞克五2 天前
Nginx 高性能Web服务器笔记
服务器·nginx
失重外太空啦2 天前
Tomcat
java·服务器·tomcat