![linux编译安装示例](https://i-blog.csdnimg.cn/blog_migrate/4896281a6ac4e68077ababea5724e78a.png)
linux编译安装示例
Today we will look SNMP in Linux operating systems. Simple network management protocol named SNMP is designed for getting info and setting configuration in its entities. These entities may be a switch, router, pc, cabinet, printer, etc. Snmp was very popular in the 2000s. Today it is popular too but used for information gathering.
今天,我们将在Linux操作系统中查看SNMP 。 名为SNMP的简单网络管理协议旨在获取信息并在其实体中设置配置。 这些实体可能是交换机,路由器,个人计算机,机柜,打印机等。Snmp在2000年代非常流行。 今天,它也很流行,但用于信息收集。
什么是SNMP? (What Is SNMP?)
SNMP is a standard which is mainly created to manage and monitor the network and network-connected devices. But during time the monitoring functionalities became popular and management functionalities are not used. SNMP has an index database named Management Information Base (MIB) used for data classification. Vendors generally publish their MIBs. For example, the Cisco MIB can be found http://www.cisco.com/public/sw-center/netmgmt/cmtk/mibs.shtml . The system that gathers SNMP info generally named Network management station. The systems that provide info or apply settings about yourself named Managed device. An agent is a tool that runs on a Managed Device and responsible for SNMP. SNMP works with UDP, ip, TCP, UNIX, udp6, tcp6
SNMP是主要创建用于管理和监视网络及网络连接设备的标准。 但是随着时间的流逝,监视功能变得流行起来,并且不使用管理功能。 SNMP具有用于数据分类的名为管理信息库(MIB)的索引数据库。 供应商通常会发布其MIB。 例如,可以在http://www.cisco.com/public/sw-center/netmgmt/cmtk/mibs.shtml中找到Cisco MIB。 收集SNMP信息的系统通常称为网络管理站。 提供信息或应用有关您自己的设置的系统称为“受管设备”。 代理是一种在受管设备上运行并负责SNMP的工具。 SNMP适用于UDP,ip,TCP,UNIX,udp6,tcp6
安装SNMP软件包 (Install SNMP Packages)
Fedora,CentOS,RedHat(Fedora, CentOS, RedHat)
In rpm-based distributions like Fedora, CentOS, Red Hat we will install the packages named net-snmp-utils
and net-snmp
like below.
在基于rpm的发行版中,例如Fedora,CentOS,Red Hat,我们将安装如下所示的名为net-snmp-utils
和net-snmp
的软件包。
$ sudo yum install net-snmp-utils net-snmp
![Install SNMP Packages](https://i-blog.csdnimg.cn/blog_migrate/7740293122327143104609a1c848488d.png)
Ubuntu,Debian,Mint,Kali(Ubuntu, Debian, Mint, Kali)
Firstly we install SNMP daemon, library, and tool with this command in fedora. Also, we can install it Debian based distributions like Ubuntu from official repositories.
首先,我们使用此命令在fedora中安装SNMP守护程序,库和工具。 另外,我们可以从官方存储库中安装基于Debian的发行版,如Ubuntu。
$ sudo apt install snmpd
启动SNMP服务 (Start SNMP Service)
After installing check the status of SNMP service named snmpd. As shown it is not started so we start it and check again the status
安装后,检查名为snmpd的SNMP服务的状态。 如图所示,它尚未启动,因此我们将其启动并再次检查状态
$ sudo systemctl start snmpd
检查SNMP服务 (Check SNMP Service)
We can check the SNMP daemon or service status with the following command.
我们可以使用以下命令检查SNMP守护程序或服务状态。
$ sudo systemctl status snmpd
![Check SNMP Service](https://i-blog.csdnimg.cn/blog_migrate/67bebfdecc7010d11202066edb908df1.png)
SNMP配置文件(SNMP Configuration File)
SNMP daemon configuration file is stored under /etc/snmp
with the name snmpd.conf
.
SNMP守护程序配置文件存储在/etc/snmp
,名称为snmpd.conf
。
$ sudo nano /etc/snmp/snmpd.conf
![SNMP Configuration File](https://i-blog.csdnimg.cn/blog_migrate/321acbc2cdad3f8696d37eab379e038b.png)
更改公共社区字符串(Change Public Community String)
We will change the public community string with ismailbaydan
in this line.
我们将在此行中使用ismailbaydan
更改公共社区字符串。
com2sec notConfigUser default ismailbaydan
重新启动SNMP服务并重新加载配置 (Restart SNMP Service and Reload Configuration)
After changing the SNMP configuration we have to reload the SNMP service to take effect new configuration. We will restart the snmpd
daemon with the following command.
更改SNMP配置后,我们必须重新加载SNMP服务以使新配置生效。 我们将使用以下命令重新启动snmpd
守护程序。
$ sudo systemctl restart snmpd
使用snmpwalk获取和显示SNMP属性/值 (Get and Display SNMP Attributes/Values with snmpwalk)
Here we run snmpwalk
for system OUID with new password and SNMP community version 2. So we get all value in the system OUID and in its sub-branches.
在这里,我们使用新密码和SNMP社区版本2为系统OUID运行snmpwalk
。因此,我们在系统OUID及其子分支中获得了所有值。
$ snmpwalk -v2c -c ismailbaydan localhost system
如何通过示例在Linux教程上安装和使用SNMP? 信息图 (How To Install and Use SNMP On Linux Tutorial with Examples? Infographic)
![How To Install and Use SNMP On Linux Tutorial with Examples? Infographic](https://i-blog.csdnimg.cn/blog_migrate/2893e54d58d7e3bc7cdb55608e53bf45.png)
翻译自: https://www.poftut.com/how-to-install-and-use-snmp-on-linux-tutorial-with-examples/
linux编译安装示例