UDP port 161 is SNMP, used by monitoring systems to read counters and status from network devices and servers. Devices send traps to managers on UDP 162. It should not be reachable from the public internet.
- Port
- 161
- Protocol
- UDP
- Service
- SNMP
- Expose to internet?
- No
- Also used by
- Net-SNMP, routers, switches, printers, UPS devices
Is port 161 safe to open?
SNMP v1 and v2c authenticate with a community string sent in plain text, and many devices still ship with the defaults public and private. A readable SNMP agent can leak interface lists, routing tables, running processes and installed software. Write access can change device configuration, and open SNMP is abused for amplification attacks.
How to secure SNMP
- Use SNMPv3 with authentication and encryption (authPriv).
- If you must use v2c, replace the default community strings and make them read-only.
- Restrict which hosts may query the agent (Net-SNMP:
rocommunity SECRET 10.0.0.0/24). - Block UDP 161 from the internet.
Check if port 161 is open
Linux: what is listening on this port
sudo ss -ulpn | grep ':161 'Windows (PowerShell): what is listening
Get-NetUDPEndpoint -LocalPort 161From another machine: is it reachable
sudo nmap -sU -p 161 HOSTTest the SNMP service itself
snmpwalk -v2c -c COMMUNITY HOST systemRestrict port 161 in the firewall
Replace 10.0.0.0/8 with the network or address that needs access. Docker publishes container ports through its own iptables rules, which bypass ufw; bind published ports to 127.0.0.1 (-p 127.0.0.1:161:161) instead of relying on the host firewall.
ufw: allow only your private network, deny everyone else
sudo ufw allow from 10.0.0.0/8 to any port 161 proto udp
sudo ufw deny 161/udpfirewalld: allow one source network only
sudo firewall-cmd --permanent --remove-port=161/udp
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.0.0/8" port port="161" protocol="udp" accept'
sudo firewall-cmd --reloadiptables
sudo iptables -A INPUT -p udp --dport 161 -s 10.0.0.0/8 -j ACCEPT
sudo iptables -A INPUT -p udp --dport 161 -j DROPWindows Firewall (PowerShell, as Administrator)
New-NetFirewallRule -DisplayName "Block 161 from internet" -Direction Inbound -Protocol UDP -LocalPort 161 -RemoteAddress Internet -Action BlockMonitor port 161
Run a TCP port monitor against your public IP on port 161: here, a failed connection is the healthy result, so you know the firewall is still doing its job. On Linux, the Statance agent also reports every listening port on the server. TCP port monitoring.
Related ports
FAQ
What is port 161 used for?
UDP port 161 is SNMP, used by monitoring systems to read counters and status from network devices and servers. Devices send traps to managers on UDP 162. It is also used by Net-SNMP, routers, switches, printers, UPS devices.
Is it safe to open port 161?
Not to the public internet. SNMP v1 and v2c authenticate with a community string sent in plain text, and many devices still ship with the defaults public and private. A readable SNMP agent can leak interface lists, routing tables, running processes and installed software. Write access can change device configuration, and open SNMP is abused for amplification attacks.
Is port 161 TCP or UDP?
SNMP uses UDP on port 161.
How do I check if port 161 is open?
On the server, run sudo ss -tulpn | grep ':161 ' (Linux) or Get-NetTCPConnection -LocalPort 161 (Windows) to see what is listening. From another machine, run nc -zv HOST 161 or Test-NetConnection HOST -Port 161.
Know the moment a port stops answering.
TCP, HTTP, DNS and SSL checks from six regions, plus server metrics from a one-line agent.