Intermediate · IP services: DHCP, DNS, NAT and more · topic 39 of 57 · 30 min
Management services: NTP, SNMP, syslog and TFTP
Explanation
NTP: the right time everywhere
NTP (Network Time Protocol) synchronises clocks over the network using UDP port 123. Correct time sounds boring until it is wrong: log messages from ten devices cannot be put in order if each clock says something different; certificates appear "not yet valid" or "expired", so HTTPS and VPNs fail; and logins with Kerberos or one-time codes fail when clocks drift by a few minutes.
NTP is arranged in strata (levels). Stratum 0 is a reference clock such as GPS or an atomic clock. A stratum 1 server is directly connected to one. A server that learns time from stratum 1 is stratum 2, and so on. Lower numbers are closer to the source. Stratum 16 means "not synchronised". In India, official time (IST) is maintained by the CSIR National Physical Laboratory in New Delhi.
R1(config)# ntp server 192.0.2.123
R1(config)# clock timezone IST 5 30
R1(config)# service timestamps log datetime msec localtime
R1# show ntp status
Clock is synchronized, stratum 3, reference is 192.0.2.123
R1# show ntp associations
R1# show clockIn a lab with no internet, ntp master 3 makes a router act as an authoritative time source at stratum 3 for the others.
SNMP: monitoring devices
SNMP (Simple Network Management Protocol) lets a monitoring system, the manager or NMS (network management station), talk to an agent running on each router, switch, firewall or printer. The agent keeps values such as interface traffic, CPU load and uptime in a structure called the MIB (management information base). Each value has an OID (object identifier), a dotted number such as 1.3.6.1.2.1.1.5.0, which is the device's name (sysName).
| Message | Direction | Purpose |
|---|---|---|
| Get / GetNext / GetBulk | Manager to agent | Read one value, the next value, or many values |
| Set | Manager to agent | Change a value (for example, shut an interface) |
| Trap | Agent to manager | Unasked alert, such as "link down". Not acknowledged. |
| Inform | Agent to manager | Like a trap, but the manager acknowledges it, so it is resent if lost |
The agent listens on UDP port 161 for Get and Set requests; the manager listens on UDP port 162 for traps and informs. SNMPv2c protects access only with a community string, a shared word sent in clear text, so anyone capturing packets can read it. SNMPv3 adds users with authentication (proving who sent the message) and encryption (hiding its contents). Use v3 with the authPriv level wherever possible.
! SNMPv2c, read-only (simple, but the community travels in clear text)
R1(config)# snmp-server community NOC-view RO
R1(config)# snmp-server host 10.0.0.20 version 2c NOC-view
R1(config)# snmp-server enable traps
! SNMPv3 with authentication and encryption
R1(config)# snmp-server group NOCGROUP v3 priv
R1(config)# snmp-server user nocadmin NOCGROUP v3 auth sha <auth-password> priv aes 128 <priv-password>Syslog: the device's diary
Devices write log messages about events: an interface going down, a neighbour lost, a login, a config change. By default they appear on the console. Syslog sends them to a central server over UDP port 514, so you can search the logs of every device in one place and keep them after a reboot. Each Cisco message has the form %FACILITY-SEVERITY-MNEMONIC: description.
*Oct 19 10:15:02.123: %LINK-3-UPDOWN: Interface GigabitEthernet0/1, changed state to down
*Oct 19 10:15:03.130: %LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/1, changed state to down
*Oct 19 10:20:41.002: %SYS-5-CONFIG_I: Configured from console by admin on vty0 (10.0.0.50)| Level | Keyword | Meaning |
|---|---|---|
| 0 | emergencies | System unusable |
| 1 | alerts | Immediate action needed |
| 2 | critical | Critical condition |
| 3 | errors | Error condition |
| 4 | warnings | Warning |
| 5 | notifications | Normal but significant |
| 6 | informational | Information only |
| 7 | debugging | Debug output |
R1(config)# logging host 10.0.0.30
R1(config)# logging trap warnings
R1(config)# logging buffered 16384 informational
R1(config)# line console 0
R1(config-line)# logging synchronous
R1# show logging
R1# terminal monitorChoosing a level means "this level and everything more serious". logging trap warnings sends 0, 1, 2, 3 and 4, but not notifications such as interface line protocol changes (level 5).
TFTP and FTP: moving files
TFTP (Trivial File Transfer Protocol, UDP port 69) is a very simple way to copy files with no login and no encryption. Network teams use it in labs and closed management networks to back up configurations and to load IOS images. FTP (TCP ports 20 and 21) adds a username and password, still unencrypted. SCP over SSH (TCP 22) is the safer choice on production networks.
R1# copy running-config tftp:
Address or name of remote host []? 10.0.0.30
Destination filename [r1-confg]? R1-2026-10-19.cfg
R1# copy tftp: flash:
R1# show flash:Need help?
Stuck on a word or an idea? Search this course, or every course, and jump straight to the explanation or a worked question.
Try:
Watch the lesson
Management services: NTP, SNMP, syslog and TFTP · 1/8
In this lesson you will meet the services that keep a network manageable: NTP, SNMP, syslog and TFTP.
Prefer a video by a teacher? Find free videos on “ccna ntp snmp syslog severity levels explained” on YouTube ↗
In real life: Finding the cause of a 2 am outage
At a payment company in Mumbai, UPI transactions failed for four minutes at 2:07 am. Because every router, switch and firewall uses the same NTP servers and sends syslog to one server, the on-call engineer filtered all messages between 2:00 and 2:15 at level 5 or more serious. In order, she saw a %LINK-3-UPDOWN on a core link, then %OSPF-5-ADJCHG neighbour down messages, then the link back up. The SNMP monitoring graph showed CRC errors rising on that port for two days. A bad optic was replaced the next morning.
Practice (0/3 done)
Cisco log lines contain a tag like %LINK-3-UPDOWN: the facility, the severity (0 to 7) and a mnemonic. Write severity(line) that returns the severity as an int, or None if the line has no such tag. Use the re module.
Now act like logging trap. Write filter_logs(lines, max_level) that returns only the lines whose severity is max_level or MORE serious (a number less than or equal to max_level), in the same order. Lines without a tag are dropped. A severity() helper is given in the starter.
A router has "logging trap notifications". Which message is NOT sent to the syslog server?
Quick quiz
Read more (free)
Related help
Before this, learn
This topic builds on these. If something here feels new, open them first.
Related topics
- QoS basics: keeping voice and video clearIP services: DHCP, DNS, NAT and more · same module
- DNS: names to addressesIP services: DHCP, DNS, NAT and more · same module
- Tuning profiles with tuned, and time with chronyLinux and Red Hat (RHCSA to RHCE) · Processes, services and logs
- Logs and log sourcesCyber Security: from zero to SOC analyst · Logs, SIEM and incident response
- Monitoring, logs and alertsFull-Stack Development · Deploying and running the app
- Ports and protocolsCyber Security: from zero to SOC analyst · Networking for security
Questions people ask about this
Open a question to see the answer and why. The first ones are this topic's own quiz, so try the quiz above before you peek.
Which port does NTP use?
Answer: UDP 123
NTP uses UDP 123. 161 is SNMP and 514 is syslog.
Which syslog severity is the most serious?
Answer: 0 emergencies
Level 0, emergencies, is the most serious; the lower the number, the worse.
Which SNMP version adds authentication and encryption?
Answer: v3
SNMPv3 has users with authentication and encryption; v1 and v2c use clear-text community strings.
A device sends an alert to the manager and the manager confirms it received it. Which SNMP message is this?
Answer: Inform
An inform is acknowledged by the manager; a trap is not.
What does stratum 1 mean for an NTP server?
Answer: It is directly connected to a reference clock such as GPS
Stratum 0 is the reference clock; a stratum 1 server is attached to it directly.
Which service keeps the clock synchronised on RHEL 9?Related
Answer: chronyd
RHEL uses chrony; ntpd is no longer shipped.
Why must all devices sync time with NTP?Related
Answer: So log timestamps line up and timelines are accurate
Mismatched clocks make it impossible to order events correctly.
From Logs and log sources
Which log line is safe to write?Related
Answer: {"requestId":"9f1c2a","status":201,"durationMs":48,"userId":17}
Ids, status codes and times help debugging. Passwords, cookies and note text must never be logged.
Traffic to a server on port 443 is…Related
Answer: Usually HTTPS, but any program can use that port
Port numbers are conventions. Malware often uses 443 to blend in with normal traffic.
From Ports and protocols
Pass the quiz (60% or more) or mark this topic as done when you are ready.
Your progress is saved on this device only.
Next steps
- 1 more topic in “IP services: DHCP, DNS, NAT and more” before its exam: QoS basics: keeping voice and video clear.
- Module 8 exam: IP services · 15 questions · 25 min, without help. 5 topics of this module still to finish first.
- Then the next module, Network security. 57 topics left in the course before the final exam.