当前位置:文档之家› Cisco网络设备的SNMP及Syslog配置参考实例

Cisco网络设备的SNMP及Syslog配置参考实例

Cisco网络设备的SNMP及Syslog配置参考实例在IOS的Enable状态下,敲入config terminal 进入全局配置状态SNMP配置Cdp run 启用CDPsnmp-server community gsunion ro 配置本路由器的只读字串为gsunionsnmp-server community gsunion rw 配置本路由器的读写字串为gsunionsnmp-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的发送源地址syslog配置1. 必配,配置将日志信息发送到指定服务器(监视服务器)logging on 起动log机制logging IP-address-server 将log记录发送到10.238.18.17 (CW2K安装机器的IP地址)上的syslog server2. 选配,设置日志发送的高级属性logging facility local7 将记录事件类型定义为local7logging trap warning 将记录事件严重级别定义为从warningl开始,一直到最紧急级别的事件全部记录到前边指定的syslog server.logging source-interface loopback0 指定记录事件的发送源地址为loopback0的IP地址service timestamps log datetime 发送记录事件的时候包含时间标记enable password ******line tty 0 4password ******login local 设置Enable口令和Telnet口令show runningcopy running start或write terminal 显示并检查配置保存配置-------------------------------------------------------------------------------------------------logging trap level //指定日志消息的级别(0:紧急(Emergencies)1:告警(Alerts)2:严重的(Critical)3:错误(Errors)4:警告(Warnings)5:通知(Notifications)6:信息(Informational)7:调试(Debugging))logging trap 7 //把调试信息设置为Debug级,记录FTP命令和WWW的URL另外可用logging facility命令更改设备号,PIX默认为local4(20)//facility标识, RFC3164 规定的本地设备标识为 local0 - local7这个是对设备的重要性进行标识而已,跟日志本身没有关系,用默认的local7即可.syslog要考虑的主要是哪些日志需要发送到日志服务器上,即日志等级,使用如下命令:device(config)#logging trap warning //日志记录级别,可用"?"查看详细内容• emergency—Logs only emergency events.• alert—Logs alert and more severe events.• critical—Logs critical and more severe events.• error—Logs error and more severe events.• warning—Logs warning and more severe events.• notice—Logs notice and more severe events.• informational—Logs informational and more severe events.• debug—Logs all events, including debug events.为了防止日志量太大,一般设置成warning就行了。

---------------------------------------------------------------------------------------------------------------CatOS设备在CatOS的Enable状态下,敲入SNMP配置set interface sc0 VLAN ID IP address 配置交换机本地管理接口所在VLAN ID,IP地址,子网掩码Set cdp enable all 启用CDPset snmp community read-only gsunion 配置本交换机的只读字串为publicset snmp community read-write-all gsunion 配置本交换机的读写字串为privateset snmp trap server-ip gsunion 指定交换机SNMP Trap的接收者为网管服务器,发送Trap时采用gsunion作为字串set snmp trap enable all 将全部类型的SNMP Trap发送出去set snmp rmon enable 激活交换机的SNMP RMON功能syslog配置set logging server IP-address-server 将log记录发送到网管服务器的IP (CW2K安装机器的IP地址)上的syslog serverset logging level 6 将记录事件严重级别定义为从informational开始,一直到最紧急级别的事件全部记录到前边指定的syslog serverset logging server facility local7 将记录事件类型定义为local7set logging timestamp 发送记录事件的时候包含时间标记set logging enable 起动log机制set password ******set enablepass ******设置Enable口令和Telnet口令show runningwrite terminal 显示并检查配置保存配置PIX设备Logging on 在PIX上面启用日志记录Snmp-server community gsunion 为PIX设备配置共同体串gsunionSnmp-server enable traps 配置PIX设备将SNMP消息发送到网管服务器Snmp-server host server-ip 在PIX设备上面配置SNMP网管服务器Logging history warning为PIX设备SNMP系统日志消息设置warning级别。

log信息到一台Syslog服务器第一步:指定一台主机接收log信息logging host [interface] ip_address [tcp[/port] | udp[/port]] [format emblem]例子logging host dmz1 192.168.1.5可以指定多台服务器来接收log信息,这样当一台服务器不在线的时候其它的服务器仍可以接收信息。

第二步:设置log级别。

logging trap severity_level (1-7)第三步:如果想在信息中包含设备的ID使用如下命令logging device-id {hostname | ipaddress if_name | string text}包含特定设备的ID(设备的名字,和特定接口的IP或者一个字串)log信息发送到SNMP管理机第一步:设置SNMP管理机的IP地址snmp-server host [if_name] ip_addr第二步:设备其它SNMP服务器的设置,也是必需的snmp-server location textsnmp-server contact textsnmp-server community key通过下面的设置来配置发送log信息到SNMP服务器上。

第一步snmp-server enable traps第二步:设置log级别:logging history severity_level (1-7)第三步:关闭syslog捕获用下面的命令:no snmp-server enable trapsCisco PIX Syslog 配置说明一:启动log服务第一步:启动loglogging on注:By de fault, the logging level is set to 3 (error).默认log的级别为3(error)第二步:设置log级别logging trap severity_level (1-7)第三步:检查log设置show logging二:测试log输出通过下面几个步骤测试log信息输出:第一步:log信息发送到console口。

logging console 7quit这个测试会产生下面的syslog信息111005: nobody End configuration: OK这个信息显示已经退出configureation mode.”111005”是该信息标识号。

“nobody”指出你是通过console口登录PIX的。

第二步:停止输送log信息到consoleno logging console 7quit三、发送syslog信息到缓存第一步:保存显示的信息logging buffered severity_level (1-7)第二步:查看console口上的信息show logging第三步:清除缓存中的信息以便接收查看新的信息clear logging第四步:停止发送log信息到缓存no logging buffered新的信息到列表的尾部。

四、把log信息发送到一个telnet会话第一步:在PIX的内部配置一个host允许telnet到PIXa. 输入下面的命令:telnet ip_address [subnet_mask] [if_name]For example, if a host has the IP address 192.168.1.2, the command is: telnet 192.168.1.2 255.255.255.255b.设置一个telnet会话的空闲时间,默认为5分钟,建议值15分钟。

相关主题