SNMP Trap is a protocol function in the SNMP protocol. In many devices, we use this self-trapping function for some management. So let's talk about some SNMP Traps in Cisco today.
Configure a Cisco IOS device
In the Enable status of IOS, click config terminal to enter 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.
- Snmp-server enable traps
- Allow routers 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
- Use the IP address of the loopback interface as the sending Source Address of the SNMP Trap.
- Logging on
- Start log Mechanism
- Logging IP-address-server
- Send the log record to the syslog server on 10.238.18.17 (IP address of the CW2K installation machine)
- Logging facility local7
- Define the record 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
- Specify the loopback0 IP address as the sending Source Address of the recorded event
- Service timestamps log datetime
- The time mark is included when a record event is sent.
- Enable password ******
- Line tty 0 4
- Password ******
- Login local
- Set the Enable password and Telnet Password
- Show running
- Copy running start or write terminal
- Display and Check Configuration
- Save Configuration
- Set the CatOS Device
- In the Enable status of CatOS
- Set interface sc0 vlan id ip address
- 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
- Set the read-only string of this switch to public.
- Set snmp community read-write-all gsunion
- Set the read/write string of the vswitch 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
- Send all types of SNMP traps
- Set snmp rmon enable
- Activate the snmp rmon function of the vswitch.
- Set logging server IP-address-server
- Send the log record 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
- Define the record event type as local7
- Set logging timestamp
- The time mark is included when a record event is sent.
- Set logging enable
- Start log Mechanism
- Set password ******
- Set enablepass ******
Set the Enable password and Telnet Password
- Show running
- Write terminal display and Check Configuration
Save Configuration
Configure a PIX Device
Logging on enables Logging on the PIX
Snmp-server community gsunion: configure the community String gsunion for the PIX Device
Snmp-server enable traps configure the PIX device to send SNMP messages to the Network Management server
Snmp-server host server-ip configure the SNMP network management server on the PIX Device
Logging history warning
Set the warning level for log messages of the snmp system of the pix device.