0

I am trying to receive a trap generated by our product on my Ubuntu 22.04, but I am not able to receive the traps on the Ubuntu. Here is the output of the netstat and lsof commands:

ubuntu@ubuntu2204:~/workplace/logs$ sudo netstat -lnp | grep 162
udp        0      0 0.0.0.0:162             0.0.0.0:*                           1/init              
udp6       0      0 :::162                  :::*                                1/init 

ubuntu@ubuntu2204:~/workplace/logs$ sudo lsof -i :162
COMMAND PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
systemd   1 root   68u  IPv4  19762      0t0  UDP *:snmp-trap 
systemd   1 root   69u  IPv6  19764      0t0  UDP *:snmp-trap

but I have already stopped the snmptrapd service:

ubuntu@ubuntu2204:~/workplace/logs$ sudo service snmptrapd stop
Warning: Stopping snmptrapd.service, but it can still be activated by:
  snmptrapd.socket

ubuntu@ubuntu2204:~/workplace/logs$ sudo service snmptrapd status
○ snmptrapd.service - Simple Network Management Protocol (SNMP) Trap Daemon.
     Loaded: loaded (/lib/systemd/system/snmptrapd.service; static)
     Active: inactive (dead) since Thu 2023-06-15 21:17:45 PDT; 14min ago
TriggeredBy: ● snmptrapd.socket
    Process: 14113 ExecStart=/usr/sbin/snmptrapd -LOw -f udp:162 udp6:162 (code=exited, status=0/SUCCESS)
   Main PID: 14113 (code=exited, status=0/SUCCESS)
        CPU: 3.588s

Jun 15 17:49:22 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 17:49:22 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 21:13:31 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 21:13:31 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 21:14:19 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 21:14:19 ubuntu snmptrapd[14113]: No access configuration - dropping trap.
Jun 15 21:17:45 ubuntu systemd[1]: Stopping Simple Network Management Protocol (SNMP) Trap Daemon....
Jun 15 21:17:45 ubuntu systemd[1]: snmptrapd.service: Deactivated successfully.
Jun 15 21:17:45 ubuntu systemd[1]: Stopped Simple Network Management Protocol (SNMP) Trap Daemon..
Jun 15 21:17:45 ubuntu systemd[1]: snmptrapd.service: Consumed 3.588s CPU time.

Is there any way of solving this issue? I have googled a lot and been stuck on this for days.

How can I configure my own snmptrapd.conf file to use another trap port like 10162 to receive trap messages? If possible, please give an example of snmptrapd.conf (for SNMPv3).

Any help will be very much appreciated. Thanks a lot in advance!

0 Answers0