4.2 Configure and verify NTP clients and servers

CCNA 200-301 v1.1 · 4.0 IP Services

Routers and switches need the same, correct time so that logs from different devices line up, certificates validate and scheduled jobs run when they should. NTP synchronises clocks over UDP 123 from a hierarchy of servers ranked by stratum. For the CCNA you make a device an NTP client, a server for others, and verify that it is synchronised.

What you must know

Clients, servers and stratum

A device configured with ntp server is a client: it asks that server for the time. Once synchronised it also answers other devices, so a router can be the LAN's time source while it follows an upstream server. Stratum counts the distance from a reference clock: an atomic or GPS clock is stratum 0, a server attached to it stratum 1, its clients stratum 2, and so on. Stratum 16 means unsynchronised.

! R1
ntp server 192.0.2.123 prefer
ntp server 192.0.2.124
ntp source Loopback0
!
! SW1 and SW2
ntp server 10.0.0.1

With no upstream server at all, ntp master 4 makes a router an authoritative source at stratum 4 from its own clock. Use it in labs or isolated networks only.

Time zone and timestamps

clock timezone EST -5
clock summer-time EDT recurring
service timestamps log datetime msec localtime show-timezone

NTP always carries UTC. The time zone is a local display setting on each device.

Authentication

Without authentication a device trusts any NTP server it reaches. With it, the client only accepts time signed with a trusted key.

ntp authenticate
ntp authentication-key 1 md5 N7pAth
ntp trusted-key 1
ntp server 10.0.0.1 key 1

Commands

show ntp associationsEach server: * synchronised to it, + candidate, - outlier, ~ configured; with stratum, reach and offset.
show ntp statusWhether the clock is synchronised, its stratum and the reference server.
show clock detailThe time and its source (NTP or user configuration).
debug ntp packetsNTP packets sent and received, to see whether the server answers.

Exam traps

Check yourself

R1 synchronises to a stratum 2 server. What stratum do its clients see?
Stratum 3 for R1, so its clients become stratum 4.
In show ntp associations, what does the * mean?
That is the server the clock is synchronised to.
Which command makes logs show the local date and time with milliseconds?
service timestamps log datetime msec localtime, together with clock timezone.
Which transport and port does NTP use?
UDP port 123.

Labs

Try it live: PAT, DHCP server and NTP

More topics in 4.0 IP Services