大网数据广告活动
服务器运维问答

CentOS 7 SNMP port always closed

· 52CE 我爱测

I have a CentOS 7 server in which I opened up ports for SNMP connections. Even though I can see the ports open here: [matias@Centos_7_VM ~]$ sudo firewall-cmd --list-all [sudo] password for matias: public (active) target: default…

问题原文

原帖链接 · Matias Barrios · CC BY-SA 4.0

I have a CentOS 7 server in which I opened up ports for SNMP connections.

Even though I can see the ports open here:

[matias@Centos_7_VM ~]$  sudo firewall-cmd --list-all
[sudo] password for matias:
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: ssh dhcpv6-client
  ports: 80/tcp 10050/tcp 50000/tcp 161/tcp 160/tcp
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

When I try to hit this port from the outside I always get that it's closed. Even nmap agrees on this:

Starting Nmap 7.01 ( https://nmap.org ) at 2018-08-01 14:52 -03
Nmap scan report for Centos_7_VM (192.168.43.216)
Host is up (0.52s latency).
Not shown: 996 filtered ports
PORT      STATE  SERVICE
22/tcp    open   ssh
80/tcp    open   http
161/tcp   closed snmp
50000/tcp closed ibm-db2

What else can I do to open these ports? (yes, I reloaded firewalld when I initially opened the ports.)

已采纳解答

原帖链接 · Michael Hampton · CC BY-SA 4.0

SNMP is a UDP protocol, not a TCP protocol. So you need to open the UDP port, i.e. 161/udp.

Better yet, just specify the service name and firewalld will take care of it.

firewall-cmd <options> --add-service=snmp

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2018-08-01)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。