Limited-Time Offer | 25% Off Dedicated Servers*Shop Now
Limited-Time Offer | 25% Off Monthly VPS Hosting | Promo Code : LW25Cloud* †††Shop Now
Dedicated Hosting Deals | From $99/moShop Now
Reading Time: 2 minutes


SNMP, or Simple Network Management Protocol, is widely used to communicate with and monitor network devices, servers, and more, all via IP. In the previous article, we installed an SNMP agent on a CentOS 6.5 server. This agent allows for the collection of data from our server and makes the information available to a remote SNMP manager. To add a little security, we'll now change the port that SNMP listens on.

Change SNMP Port

Preflight Check

  • These instructions are intended for changing the SNMP port.
  • I’ll be working from a Liquid Web Core Managed CentOS 6.5 server, and I'll be logged in as root.
  • SNMP is installed and configured per the tutorial on How To Install and Configure SNMP on CentOS.

Change the SNMP Port

First, echo a new configuration into the SNMP configuration file:

echo OPTIONS=\"-LS0-5d -Lf /dev/null -p /var/run/ -x TCP:13371 UDP:13371\" >> /etc/sysconfig/snmpd

-LS0-5d specifies the logging level. In this case levels 0 through 5 will be logged; log levels are defined as follows:

0 or ! for LOG_EMERG,
1 or a for LOG_ALERT,
2 or c for LOG_CRIT,
3 or e for LOG_ERR,
4 or w for LOG_WARNING,
5 or n for LOG_NOTICE,
6 or i for LOG_INFO, and
7 or d for LOG_DEBUG.

-p /var/run/ saves the process ID of the daemon into /var/run/

-x TCP:13371 UDP:13371 listens on port 13371 (TCP and UDP) on all IPv4 interfaces. Port 13371 was used specifically for this tutorial, and can be replaced with a custom report number.

Now, restart the SNMP service to reload the new configuration file:

service snmpd restart

Test the SNMP Configuration

To verify that SNMP is now listening on the correct port use the following command:

netstat -lnp | grep snmp

Let's test the SNMP configuration... try running the following two commands:

snmpwalk -v 2c -c idv90we3rnov90wer -O e

Note: idv90we3rnov90wer is the "community" used in the previous tutorial; your community string will likely be different. If you're going to connect to SNMP from a remote server, be sure your server's firewall has the appropriate ports open
Series Navigation
<< Previous Article
Avatar for Justin Palmer

About the Author: Justin Palmer

Justin Palmer is a professional application developer with Liquid Web

Latest Articles

How to Install WordPress on Linux (AlmaLinux)

Read Article

What is CentOS? Everything You Need to Know

Read Article

What is CentOS? Everything You Need to Know

Read Article

Redis as Cache: How It Works and Why You Should Use It

Read Article

Refer-a-Friend Program for Website Hosting: Get $100 for Each Friend!

Read Article