3

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.)

| improve this question | | | | |
  • 1
    a) SNMP works over UDP, not TCP. b) Is there something listening on this port anyway? – Sven Aug 1 '18 at 18:10
  • @Sven Waht a dumb mistake. Thanks so much! its working now ( yes, snmp daemon is listening and responding ) – Matias Barrios Aug 1 '18 at 18:14
6

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
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.