爲了方便監控交換機和路由器的工作狀態,我們可以設置工作電腦作爲日誌服務器,隨時查看網絡設備的工作情況。我的電腦使用WIN7英文旗艦版,通過3CDaemon軟件設置好syslog服務器。
思科日誌服務器配置可參考以下命令:
R1#conf t
R1(config)#logging on
R1(config)#logging HOST 192.168.104.201 //日誌服務器的IP地址
R1(config)#logging facilit y local0
//facility標識, RFC3164 規定的本地設備標識爲 local0 - local7 ()
R1(config)#logging trap 6 //日誌記錄級別
R1(config)#logging trap ?可用"?"查看詳細內容
R1 (config)#logging trap ?
<0-7> Logging severity level
alerts Immediate action needed (severity=1)
critical Critical conditions (severity=2)
debugging Debugging messages (severity=7)
emergencies System is unusable (severity=0)
errors Error conditions (severity=3)
informational Informational messages (severity=6)
notifications Normal but significant conditions (severity=5)
warnings Warning conditions (severity=4)
<cr>
R1(config)#logging source-interface Gi0/45 //日誌發出用的源IP地址
R1(config)#service timestamps log datetime msec localtime show-timezone
//日誌記錄的時間戳設置,可根據需要具體配置
檢驗,查看
R1#sh logging
華爲S3526交換機日誌服務器配置可參考如下配置:
[dabaicai2#]info-center ?
console Setting of console configuration
enable Enable the infomation center
logbuffer Setting of log buffer configuration
loghost Setting of logging host configuration
monitor Setting of monitor configuration
snmp Setting of snmp configuration
source Informational source setting
timestamp Set the timestamp type of information
trapbuffer Setting of trap buffer configuration
[dabaicai2#]info-center loghost 192.168.104.201
[dabaicai2#]quit
<dabaicai2#>save
This will save the configuration in the flash memory.
The switch configurations will be written to flash.
Are you sure?[Y/N]
Before pressing ENTER you must choose 'YES' or 'NO'[Y/N]:y
Now saving current configuration to flash memory.
Please wait for a while...
Save current configuration to flash memory successfully.