How To Change the SNMP Port on CentOS

Cpanel/Whm License $3/mo Plesk License $10/mo Cloudlinux License $5/mo

SNMP 101: The Basics
I. How To Install and Configure SNMP on CentOS
II. How To Change the SNMP Port on CentOS
Introduction

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.

Pre-Flight Check
  • These instructions are intended for changing the SNMP port.
  • I’ll be working from a sxi.io 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/snmpd.pid -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/snmpd.pid saves the process ID of the daemon into /var/run/snmpd.pid.

-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 127.0.0.1:13371

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

Related posts

Garza Pleads Guilty: GAW Miners CEO Cops to $9 Million Fraud

SXI ADMIN

Swiss Blockchain Consortium Develops Ethereum Trading Tool

SXI ADMIN

Caribbean Bitcoin Exchange Launches Following $1.5 Million Raise

SXI ADMIN

Linux: Convert a PDF File To an Image

SXI ADMIN

Alaskan ‘Judge’ Wants Pope Francis to Endorse the Blockchain

SXI ADMIN

Coinbase Announces Bitcoin Hackathon with $70,000 in Prizes

SXI ADMIN

Self-signed SSL Certificate Warnings

SXI ADMIN

Fur Real? Businesses Test CryptoKitties-Inspired Ethereum Tech

SXI ADMIN

Hyperledger Bond Trading Platform Goes Open Source

SXI ADMIN

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More