snmp默认监听端口是 udp 161

出于安全考虑,我们希望更改监听端口,指定监听地址和端口,实现如下:

[<transport-specifier>:]<transport-address>

           <transport-specifier>       <transport-address> format

           udp (default)               hostname[:port] or IPv4-address[:port]

           tcp                         hostname[:port] or IPv4-address[:port]

           unix                        pathname

           ipx                         [network]:node[/port]

           aal5pvc or pvc              [interface.][VPI.]VCI

           udp6 or udpv6 or udpipv6    hostname[:port] or IPv6-address[:port]

           tcp6 or tcpv6 or tcpipv6    hostname[:port] or IPv6-address[:port]

注:<transport-specifier>大小写不敏感。


最简单的实现如下:

/usr/sbin/snmpd tcp:端口或/usr/sbin/snmpd udp:端口

vim /etc/sysconfig/snmpd

修改前 # OPTIONS="-LS0-6d"

修改后   OPTIONS="tcp:34750 -LS0-6d"

重启snmpd服务    service snmpd restart