是否可以让 Net-SNMP 通过 TCP 而不是 UDP 运行?
可以在终端配置守护程序以侦听 TCP 连接:
snmpd tcp:1161
但是,没有snmpget
使用 TCP 的标志吗?
答案1
我认为 snmpget 也支持这一点。 snmpcmd(1M) 手册页上描述了一些常见功能,但他们不会在所有单独的命令页上重复这些功能。
Agent Specification
The agent specification (see SYNOPSIS) takes the form:
[transport-specifier:]transport-address
At its simplest, the agent specification consists of a host-
name or an IPv4 address in the standard, "dotted quad" nota-
tion. In this case, communication will be attempted using
UDP/IPv4 to port 161 of the given host. Otherwise, the
transport-address part of the specification is parsed
according to the following table:
<transport-specifier> <transport-address> format
udp hostname[:port]
Note that transport-specifier strings are case-insensitive
so that, for example, "tcp" and "TCP" are equivalent. Here
are some examples, along with interpretations:
myhost:161
Perform query using UDP/IPv4 datagrams sent to myhost on
port 161. The :161 is redundant here because that is the
default SNMP port.
udp:myhost
Identical to the previous specification. The udp: is redun-
dant here because UDP/IPv4 is the default transport.