SNMP的诞生到现在,一直都是被人所看好,尽管它也存在着安全问题。那么现在我们就来对思科设备中的SNMP

trap功能进行设置。

在SNMP协议中,我们常常将之运用到硬件的设配中。随着SNMP的普及,几乎所有设备中都默认添加了SNMP功能。那么我们今天主要讲一下思科设备中的SNMP

trap设置。那么接下来就是具体的设置内容了。

一、设置IOS设备(路由器)

config terminal 进入全局配置状态

Cdp run 启用CDP snmp-server community gsunion ro

配置本路由器的只读字串为gsunion snmp-server community gsunion rw

配置本路由器的读写字串为gsunion snmp-server enable traps 允许路由器将所有类型SNMP

Trap发送出去 snmp-server host IP-address-server traps trapcomm 指定路由器SNMP

Trap的接收者为10.238.18.17,发送Trap时采用trapcomm作为字串 snmp-server trap-source loopback0 将loopback接口的IP地址作为SNMP

Trap的发送源地址 logging on 起动log机制 logging IP-address-server 将log记录发送到10.238.18.17

(CW2K安装机器的IP地址)上的syslog server logging facility local7 将记录事件类型定义为local7 logging trap warning

将记录事件严重级别定义为从warningl开始,一直到最紧急级别的事件全部记录到前边指定的syslog

server. logging source-interface loopback0

指定记录事件的发送源地址为loopback0的IP地址 service timestamps log datetime

发送记录事件的时候包含时间标记 enable password ****** copy running start或write terminal保存配置

1.启用SNMP:

configure terminal snmp-server community rw/ro (example: snmp-server community public

ro)

2.启用陷阱:

configure terminal snmp-server enable traps snmp authentication

3.配置snmp

#conf t #snmp-server community cisco ro(只读)

;配置只读通信字符串 #snmp-server community secret rw(读写)

;配置读写通信字符串 #snmp-server enable traps ;配置网关SNMP TRAP #snmp-server host 10.254.190.1 rw ;配置网关工作站地址 二、设置CatOS设备(交换机)

在CatOS的Enable状态下,敲入set interface sc0 VLAN ID IP address

配置交换机本地管理接口所在VLAN ID,IP地址,子网掩码

Set cdp enable all 启用CDP set snmp community read-only gsunion

配置本交换机的只读字串为public set snmp community read-write-all gsunion

配置本交换机的读写字串为private set snmp trap server-ip gsunion 指定交换机SNMP

Trap的接收者为网管服务器,发送Trap时采用gsunion作为字串 set snmp trap enable all 将全部类型的SNMP

Trap发送出去 set snmp rmon enable 激活交换机的SNMP RMON功能 set

logging server IP-address-server 将log记录发送到网管服务器的IP

(CW2K安装机器的IP地址)上的syslog server set logging level 6

将记录事件严重级别定义为从informational开始,一直到最紧急级别的事件全部记录到前边指定的syslog

server set logging server facility local7

将记录事件类型定义为local7 set logging timestamp 发送记录事件的时候包含时间标记 set logging enable 起动log机制 write terminal 显示并检查配置 保存配置