In the SNMP protocol, we often apply it to the configuration of hardware. With the popularization of SNMP, SNMP is added by default to almost all devices. Today we will focus on the SNMP trap settings in Cisco devices. The following figure shows the specific settings.
1. Set IOS devices (routers)
- Config terminal enters the global configuration status
- Enable Cdp run
- Snmp-server community gsunion ro: configure the read-only string of this vro as gsunion
- Snmp-server community gsunion rw: configure the read/write string of the vro as gsunion.
- S nmp-server enable traps allows the router to send all types of SNMP traps
- Snmp-server host IP-address-server traps trapcomm
- The receiver of the SNMP Trap on the specified router is 10.238.18.17. trapcomm is used as the string for sending the Trap.
- Snmp-server trap-source loopback0 uses the IP address of the loopback interface as the sending source Address of the SNMP Trap.
- Logging on starts the log Mechanism
- Logging IP-address-server sends the log records to the syslog server on 10.238.18.17 (IP address of the CW2K installation machine ).
- Logging facility local7 defines the logging event type as local7
- Logging trap warning
- Define the Severity Level of the recorded event as from warningl to the syslog server specified in the front.
- Logging source-interface loopback0 specifies the IP address from which the event is sent to loopback0.
- Service timestamps log datetime contains a time mark when sending a record event
- Enable password ******
- Copy running start or write terminal to save the configuration
1. Enable SNMP:
- configure terminal
- snmp-server community rw/ro (example: snmp-server community public ro)
2. Enable the trap:
- configure terminal
- snmp-server enable traps snmp authentication
3. Configure snmp
- # Conf t
- # Snmp-server community cisco ro read-only); configure the read-only communication string
- # Snmp-server community secret rw read/write); configure the read/write communication string
- # Snmp-server enable traps; configure the gateway SNMP TRAP
- # Snmp-server host 10.254.190.1 rw; configure the gateway workstation address
Ii. Set the CatOS device (switch)
In the Enable status of CatOS, enter the set interface sc0 vlan id ip address to configure the vlan id, IP address, and subnet mask of the local management interface of the switch.
- Set cdp enable all enable CDP
- Set snmp community read-only gsunion configure the read-only string of this switch to public
- Set snmp community read-write-all gsunion configure the read/write string of this switch to private
- Set snmp trap server-ip gsunion
-
- The receiver of the SNMP Trap on the specified switch is the network management server, and gsunion is used as the string for sending the Trap.
- Set snmp trap enable all sends all types of SNMP traps
- Set snmp rmon enable activates the snmp rmon function of the switch.
- Set logging server IP-address-server sends log records to the syslog server on the IP address of the network management server (IP address of the CW2K installation machine)
- Set logging level 6
- Define the Severity Level of recorded events as starting from informational to recording all events at the most urgent level to the syslog server specified at the front.
- Set logging server facility local7 defines the logging event type as local7
- Set logging timestamp contains a time mark when sending a record event
- Set logging enable
- Write terminal display and Check Configuration
- Save Configuration