Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Net-snmpd installation and basic configuration tutorials in CentOS

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "net-snmpd installation and basic configuration tutorial in CentOS". The explanation in this article is simple and clear and easy to learn and understand. Please follow the editor's train of thought to study and learn the net-snmpd installation and basic configuration tutorial in CentOS.

Installation

The code is as follows:

Yum install net-snmp net-snmp-devel

Net-snmp-config-- create-snmpv3-user-a password username

Chkconfig snmpd on

Service snmpd start

Finish it!

Create a user

The code is as follows:

/ usr/local/snmp/bin/net-snmp-create-v3-user

If prompted to enter a user name and password, the user is automatically added to the configuration file.

Then set the boot boot snmp

The code is as follows:

Vi / etc/rc.local

Add

The code is as follows:

/ usr/local/snmp/sbin/snmpd

You can add it to the monitoring treasure

Configuration file snmpd.conf configuration description for net-snmp

The predecessor of SNMP (Simple Network Management Protocol, simple Network Management Protocol) is simple Gateway Monitoring Protocol (SGMP), which is used to manage communication lines. There are many configuration items for snmpd.conf, but there are only a few that are really commonly used. Let's introduce them one by one.

The com2sec command, whose basic syntax is "com2sec NAME SOURCE COMMUNITY". Here I would like to mention the security policy of SNMP. In fact, the security of SNMP is not good. COMMUNITY is used for access control in this protocol. To put it simply, there is a man in a gang who has found the general rudder, so how can this person recognize the general rudder? They directly agree on a "code". For example, when they meet, they say, "there is bright moonlight in front of the bed", then the front desk of the main rudder will take you to the place where "there is bright moonlight in front of the bed". Now looking back at this line configuration, if there is the following sentence

The code is as follows:

Com2sec magusu default magus

It means to make a mapping between the COMMUNITY string of magus and the name magusu, so that when you call SNMP later, as long as you declare that you are magus, then you can get the corresponding permissions. After you have the mapping, what you need to do is to establish a mapping from magusu to group. The command used is group, and its basic syntax is "group NAME MODEL SECURITY".

The code is as follows:

Group magusg v2c magusu

The meaning of the above sentence is to put magusu into the group magusg, using the protocol V2C. By the way, SNMP now usually uses three versions. All right, what are you going to do when it's set up? To create a VIEW,VIEW, the basic syntax is "view NAME TYPE SUBTREE [MASK]".

The code is as follows:

View magusv included .1.3.6.1.4.1.9129

Like the above sentence means to give the view magusv permission to view all nodes below 1.3.6.1.4.1.9129. The last thing to do is to set which groups of people, which view users can do what specific things, using access to set, the basic syntax is "access NAME CONTEXT MODEL LEVEL PREFX READ WRITE NOTIFY".

The code is as follows:

Access magusg "" any noauth exact magusv magusv none

Because the V2C version of the protocol is used in the example, CONTEXT must be empty, and MODEL is the version number of the protocol. In this example, it can be any or V2C, or because of V2C, LEVEL is noauth;READ, WRITE and NOTIFY need to specify a view or nothing. The setting here is that the view magusv can read and write to the previously set node.

Now that the server has been configured, just restart snmpd. Let's see how to get the data we want through SNMP.

The code is as follows:

Snmpwalk-v 2c-c magus localhost 1.3.6.1.4.1.9129.1.2.2

Snmpwalk can facilitate all the child nodes under the specified node, and the-v parameter specifies the protocol version of SNMP, which is consistent with the version of the server we configured before, that is, 2c, and then the-c parameter specifies the string of community, that is, the magus just defined, and then the host address. Because I am testing locally, the localhost I use can actually fill in IP, and finally the value of OID. Got it!

For friends who have just come into contact with SNMP, understanding the role of community is the key. In fact, the popular point is not only a joint code, but also a plaintext "code".

In the new version, the configuration file adds a new and easier configuration method, but it is still compatible with the above configuration methods.

Thank you for reading, the above is the "net-snmpd installation and basic configuration tutorial in CentOS", after the study of this article, I believe you have a deeper understanding of the net-snmpd installation and basic configuration tutorial in CentOS, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report