
snmp同步端口号
Simple Network Management Protocol aka SNMP is used to monitor and manage devices over the computer networks. SNMP is popularly used to monitor network devices. SNMP protocol communication is done over the SNMP ports which can be different according to operation and security.
简单网络管理协议(又称SNMP)用于监视和管理计算机网络上的设备。 SNMP通常用于监视网络设备。 SNMP协议通信是通过SNMP端口完成的,根据操作和安全性,SNMP端口可以有所不同。
SNMP端口 (SNMP Ports)
SNMP uses UDP 161 by default. UDP is an alternative transmission protocol that has some advantages and disadvantages according to the TCP protocol. UDP provides low operation overhead and simplicity according to the TCP. But there are no sessions and transmission control over the packets. This feature makes UDP a perfect SNMP protocol.
SNMP默认使用UDP 161。 UDP是一种可选的传输协议,根据TCP协议,它具有一些优点和缺点。 UDP根据TCP提供了低操作开销和简单性。 但是没有会话和数据包的传输控制。 此功能使UDP成为完美的SNMP协议。
- `SNMP` uses UDP 161 port. SNMP使用UDP 161端口。
- `SNMP Trap/Inform` uses UDP 162 port. SNMP陷阱/通知使用UDP 162端口。
安全的SNMP端口 (Secure SNMP Ports)
Security is important for today’s protocols. When SNMP is created the security was not an important topic and SNMP is created without any security mechanism. With the advancement of security, SNMP added some security extensions like encryption. Secure SNMP is defined with the RFC 3114 and RFC 3826. Also, this Secure SNMP uses different ports UDP 10161 and UDP 10162. As we can see they are similar to the UDP 161 and UDP 162.
安全性对于当今的协议很重要。 创建SNMP时,安全性不是重要主题,并且创建SNMP时没有任何安全性机制。 随着安全性的提高,SNMP添加了一些安全性扩展,例如加密。 安全SNMP是使用RFC 3114和RFC 3826定义的。此外,该安全SNMP使用不同的端口UDP 10161和UDP10162。我们可以看到它们类似于UDP 161和UDP 162。
在Ubuntu,Debian,Mint,Kali上更改SNMP端口 (Change SNMP Port On Ubuntu, Debian, Mint, Kali)
On Debian based systems like Ubuntu, Debian, Mint, Kali the SNMP service configuration is stored in the /etc/snmp/snmpd.conf
. We can set and change the new port for the SNMP service from this snmpd.conf
file. As it is an administrative level configuration we need to edit this file with root privileges by using the nano
text editor with sudo
command.
在基于Debian的系统(如Ubuntu,Debian,Mint,Kali)上,SNMP服务配置存储在/etc/snmp/snmpd.conf
。 我们可以从此snmpd.conf
文件设置和更改SNMP服务的新端口。 由于它是管理级别的配置,因此我们需要使用带有sudo
命令的nano
文本编辑器以root权限编辑此文件。

The following line specifies that listen for the only localhost for port number 161.
以下行指定侦听端口号161的唯一本地主机。
agentAddress udp:127.0.0.1:161
We can change this to listen to all interfaces for the port 5678 .
我们可以更改它以侦听端口5678的所有接口。
agentAddress udp:0.0.0.0:5678
After saving the new configuration in order to make it effective we will restart the snmpd
service with the systemctl
command like below.
保存新配置以使其生效后,我们将使用systemctl
命令重新启动snmpd
服务,如下所示。
$ sudo systemctl restart snmpd
检查SNMP端口状态 (Check SNMP Port Status)
We can also check if it is restarted properly like below. If there is a configuration error it will stop but not start.
我们还可以检查它是否正确重启,如下所示。 如果存在配置错误,它将停止但不会启动。
$ sudo systemctl status snmpd

We can also use netstat
command in order to check whether the new SNMP port is opened like below. -ul
simply means list listening UDP ports.
我们还可以使用netstat
命令来检查新的SNMP端口是否打开,如下所示。 -ul
仅表示列出侦听的UDP端口。
$ netstat -ul

使用Nmap扫描SNMP端口 (Scan SNMP Ports with Nmap)
nmap
is a powerful tool that is used to scan networks. We can use nmap in order to identify SNMP services on the given network or hosts. In this example, we will scan two hosts with IP addresses 192.168.142.150 and 192.168.122.1 but we can also use 192.168.142.0/24 in order to scan the whole network.
nmap
是用于扫描网络的功能强大的工具。 我们可以使用nmap来识别给定网络或主机上的SNMP服务。 在此示例中,我们将扫描两个IP地址为192.168.142.150和192.168.122.1的主机,但是我们也可以使用192.168.142.0/24来扫描整个网络。
$ sudo nmap -sU -p 161 192.168.142.150 192.168.122.1

From the nmap result, we can see that SNMP ports are open which means the SNMP service is running.
从nmap结果中,我们可以看到SNMP端口已打开,这意味着SNMP服务正在运行。
使用Wireshark捕获SNMP端口流量 (Capture SNMP Port Traffic with Wireshark)
Wireshark is used to capture network traffic. We can use Wireshark in order to capture SNMP traffic in the local system. We will use the following filter in order to filter SNMP in the captured traffic. We will use the snmp
filter like below.
Wireshark用于捕获网络流量。 我们可以使用Wireshark来捕获本地系统中的SNMP流量。 我们将使用以下过滤器,以便在捕获的流量中过滤SNMP。 我们将使用如下的snmp
过滤器。

使用Tcpdump捕获SNMP端口流量(Capture SNMP Port Traffic with Tcpdump)
We can use tcpdump
command-line tool in order to capture the SNMP port traffic. We will use the -i
option in order to specify the port name which wi lo
in this case. We will also provide the port number by using port 161
parameter.
我们可以使用tcpdump
命令行工具来捕获SNMP端口流量。 我们将使用-i
选项,以指定无线端口名称lo
在这种情况下。 我们还将使用port 161
参数提供端口号。
$ sudo tcpdump -i lo port 161

翻译自: https://www.poftut.com/snmp-port-number-tutorial-with-examples/
snmp同步端口号