---
type: Setup Guide
title: "How to Change the SNMP Port (and When to)"
description: "Move the net-snmp agent off UDP 161 with agentAddress, update the firewall and managers, and understand why a custom port is obscurity rather than security."
resource: "https://snmp-monitoring.info/setup/port/"
tags: [setup]
timestamp: 2026-07-11T00:00:00Z
---

# How to Change the SNMP Port (and When to)

Move the net-snmp agent off UDP 161 with agentAddress, update the firewall and managers, and understand why a custom port is obscurity rather than security.

## Related concepts

- Up: [SNMP Setup & Configuration: Install, Secure & Test](/setup/index.md)

## Frequently asked questions

### How do I change the SNMP port?

Edit agentAddress in /etc/snmp/snmpd.conf — e.g. agentAddress udp:16100 — then restart snmpd. Update your firewall to open the new port and close 161, and reconfigure every manager to target <host>:<port>. Verify with snmpwalk -v2c -c <string> <host>:16100 system.

### Does changing the port improve security?

Only marginally, and only as obscurity. A custom port reduces noise from mass scanners that probe 161, but a targeted attacker finds it with a quick port scan, and the traffic is exactly as exposed as before. Real protection comes from SNMPv3, an OID allowlist, and a source-IP firewall — not the port number.

### How do I poll SNMP on a custom port?

Append the port to the host argument: snmpwalk -v2c -c <string> <host>:16100 system (and likewise for snmpget). In a monitoring platform, set the device's SNMP port field to the new value. Every poller must be updated, or it will keep querying 161 and time out.

### Do I need to update the firewall after changing the port?

Yes. The agent no longer listens on 161, so open the new port to your manager's source IP and remove the old 161 rule — leaving it open is attack surface with nothing behind it. If you relocate traps too, update the trap port (default 162) on both sender and receiver.

## Source

Concept generated from https://snmp-monitoring.info/setup/port/ — the SNMP Monitoring vendor-neutral knowledge base. Content is limited to what that page states (no external claims added here).
