******************************************** Cisco - Monitoring Campus Networks - Logging ******************************************** Logging Overview ================ - Used to monitor events taking place on the switch - Having accurate time is important to correlate events across the entire network - Detect failures and assist with troubleshooting Syslog Messages =============== - Audit trail describing important events that have occured - Identify what, when and how an event occured - Message Format * Timestamp * Facility Code * Severity (0-7, 0 being most severe) * Mnumonic * Message Text - Severity Levels (Highest to Lowest Severity) * Emergencies (0) * Alerts (1) * Critical (2) * Errors (3) * Warnings (4) * Notification (5) * Informational (6) * Debugging (7) Logging Destinations ==================== - Console * Defaults to the debugging (7) severity level * Only by default logs to serial console - Internal Buffer * Stored in internal memory * Lost if switch crashes/powered off/reloaded * Disabled by default * Default buffer size of 4096 bytes - Remote Syslog Server * Uses UDP over port 51 by default * Severity and server IPs must be defined Adding Timestamps to Syslog Messages ==================================== - Important for viewing non-real time historical events - Default timestamp is the "Uptime" of the switch - The Uptime will become more coarse over time (E.g. 3w2d) - Clock Sync options * Manually * NTP / Authenticated NTP * SNTP - Timezone can be defined as can offset from UTC - Daylight Saving Time (DST) must be configued Manually Using NTP to Synchronising with External Time Source ==================================================== - Ensures consisten time across multiple devices - Accounts for delay during NTP synchronisation - A hierarchy of servers can be defined by specifying the "Stratum" value - Higher Stratums are considered more accurate - Multiple tiers of NTP servers allow for greater scaleability - The server configured with the lowest stratum value is preferred over others NTP Modes --------- - Server * Synchronise with a lowest stratum source * Provides time sync to other servers/devices - Client * Syncs its clock with an NTP server - Peer * Exchanges time with another peer device - Broadcast/Multicast * Operates as an NTP server * Pushes time information to listening devices * Not as accurate as other modes Securing NTP ------------ - Methods * NTP Authentication * Restrict access by IP and Activity - NTP Authentication * Does not encrypt data * Ensures client is talkin to a "trusted" server * Does not restrict access even when "key" is configured - Restrict access by IP and Activity * Configuring an authentication key only validates the server * Access List can be used to define what action the listed IP/subnets can carry out * Valid Activities * Serve-only - Only Sync Request permitted * Serve - Sync and control requests, cannot sync * Peer - Sync and control requests, can sync time * Query-Only - Permit only control queries - Using SNTP to Synchronise Time * A reduced set of NTP functions * Operates as client only * Time Sync is simplified but less accurate Configure Logging ================= **Set Severity For Console Logging** (Default: Debugging) *NOTE: Severity can be either a number (0 being most severe) or the descriptive name (E.g. critical)* :: logging console **Set Severity For Internal Buffer** (Default: Disabled) *NOTE: Severity can be either a number (0 being most severe) or the descriptive name (E.g. critical)* :: logging buffered **Set Size of Internal Logging Buffer** (Default: 4096 bytes) :: logging buffered **Set Severity To Send To Remote Syslog Server** *NOTE: Severity can be either a number (0 being most severe) or the descriptive name (E.g. critical)* :: logging trap **Set Syslog Servers To Receive Messages** *Note: Multiple servers can be configured and all will receive the messages* :: logging host **Disable/Enable Logging Of Interface Status Changes** :: [no] logging event link-status **Set The Timestamp To Include On Log Messages** *NOTE: Applies to all logged message irrelevent of logging destination* :: service timestamps log datetime [localtime] [show-time-zone] [msec] [year] **Show Messages In The Internal Bufffer And Logging Settings** :: show logging Configuring Clock On A Switch ============================= **Manually Set the Client** *NOTE: Completed from privileged exec mode, not configure mode* :: clock set [::] [] [] [] **Define The Local Timezone** :: clock timezone [] **Define Daylight Saving Times** *NOTE: Use one of the below methods** :: clock summer-time date : : [:] clock summer-time recurring [ : :] [] **Define NTP Server** :: ntp server [prefer] version {3 | 4}] **Setup NTP Authentication** :: ntp authentication-key md5 ntp authenticate ntp trusted-key ntp server key **Restrict Access To NTP** :: access-list permit ntp access-group {serve-only|serve|peer|query-only} **Configure SNTP With Authentication** :: sntp authentication-key md5 sntp authenticate sntp trusted-key sntp server key **Verifying NTP Synchronisation** :: show ntp status **Display A Summary Of Configured NTP Relationships** :: show ntp associations