Infrastructure · Topic 9 of 13

Interpreting NTP and PTP Configurations

Read and verify NTP configurations on Cisco IOS XE, covering stratum, servers, authentication and show commands, and see how PTP gives finer time.

  • 5 min
In a nutshell
  • NTP uses UDP port 123. PTP uses UDP ports 319 and 320.
  • Stratum 0 is a reference clock, and each hop adds one. Stratum 16 means unsynchronised.
  • ntp server ADDRESS configures a client. ntp master N makes a device a source.

What it is

Network devices need the same time so that logs, certificates and troubleshooting make sense.

The Network Time Protocol (NTP) keeps clocks in step across an IP network, usually to within a few milliseconds. The Precision Time Protocol (PTP) is for cases that need much finer accuracy, such as financial trading, broadcast video and industrial control. Both work by comparing a device clock with a better one.

Reference clockGPS or atomicstratum 0NTP serverstratum 1servesRouterstratum 2servesSwitchstratum 3

How it works

NTP builds a tree of servers, and PTP builds a master and follower hierarchy.

NTP stratum

The stratum says how far a clock is from a reference clock. A reference clock is stratum 0. A server directly attached to it is stratum 1.

Each hop away adds one, and a lower stratum is closer to the source and is preferred. Stratum 16 means that the clock is not synchronised. NTP uses UDP port 123.

NTP modes

ModeDescription
ClientAsks a server for the time, and does not serve others
ServerAnswers client requests
Peer (symmetric)Two devices that can each synchronise with the other
Broadcast and multicastA server sends time to many clients on a segment

Configuring an NTP client

R1(config)# ntp server 192.0.2.10
R1(config)# ntp server 192.0.2.11 prefer
R1(config)# clock timezone GMT 0
R1(config)# ntp source Loopback0

The ntp server command makes the router a client of that server. The keyword prefer marks the favoured server when two are of similar quality.

Using more than one server gives you a backup. The ntp source command sets the source interface for NTP packets, so the server sees a predictable address.

Making a router a time source

A router with no outside source can act as its own authority. This is useful in a lab, but should not be used in production without care.

R2(config)# ntp master 3

The number is the stratum that the router claims. Use a higher number than any real source, so that a real server wins if one is available.

NTP authentication

Authentication stops a device from accepting time from an unknown source.

R1(config)# ntp authenticate
R1(config)# ntp authentication-key 1 md5 MYKEY
R1(config)# ntp trusted-key 1
R1(config)# ntp server 192.0.2.10 key 1

The key number and the key text must match on the server. The trusted-key command tells the client which keys it may accept.

Verifying NTP

R1# show ntp status
R1# show ntp associations
R1# show clock detail

show ntp status should say that the clock is synchronised, and it shows the stratum and the reference server. show ntp associations lists the servers, with a mark in the first column.

MarkMeaning
*The server that this device is synchronised to
+A good candidate server
~A configured server, not yet selected

If the status says unsynchronised, check IP reachability to the server, the key settings, and any access list that blocks UDP 123. Synchronisation can take a few minutes after the configuration is applied.

Check reachping serverokCheck statusshow ntp statussynchronisedCheck sourceshow ntp associations

PTP basics

PTP follows IEEE 1588. It can reach accuracy in the sub microsecond range, because the hardware adds timestamps as messages leave and arrive. NTP does this in software, which limits its precision.

PTP devices have clear roles.

RoleDescription
Grandmaster clockThe best clock, which is the source for the domain
Ordinary clockA device with one PTP port, such as a server
Boundary clockA switch or router that synchronises to a master on one port and acts as a master on others
Transparent clockA switch that passes PTP messages and corrects them for the time they spend inside

The devices choose the grandmaster with the best master clock algorithm, based on clock quality and priority values. PTP uses message exchanges with names such as Sync, Follow Up, Delay Request and Delay Response. It uses UDP ports 319 and 320 over IP.

Grandmasterbest clockSync messagesBoundary clockswitchSync messagesFollowerserver or device

Boundary and transparent clocks matter because switches add delay that varies with load. A boundary clock removes that error by acting as its own source. A transparent clock measures the delay and corrects for it.

What to remember for the exam

Eight facts cover most questions on this topic.

  • NTP uses UDP port 123. PTP uses UDP ports 319 and 320.
  • Stratum 0 is a reference clock, and each hop adds one. Stratum 16 means unsynchronised.
  • ntp server ADDRESS configures a client. ntp master N makes a device a source.
  • ntp authenticate, ntp authentication-key and ntp trusted-key set up authentication.
  • show ntp status and show ntp associations verify NTP.
  • An asterisk marks the server that the device is synchronised to.
  • PTP follows IEEE 1588 and is much more precise than NTP.
  • PTP roles include grandmaster, ordinary, boundary and transparent clocks.
Exam tip

In show ntp associations, the line with the asterisk is the chosen server. Check that line first.

Common mistakes

These four mistakes appear often.

Reading a high stratum as better. A lower stratum is closer to the source.

Setting ntp master with a low number in production. The router can then win over a real server.

Mismatching key numbers or text. Authentication fails and the clock stays unsynchronised.

Treating PTP as only a faster NTP. PTP relies on hardware timestamps and special clock roles.

Watch out

Do not expect NTP to synchronise at once. The first sync can take several minutes after you configure the server.

Check yourself

Work through these three questions.

  • What does stratum 1 mean in NTP?

    The server is directly attached to a stratum 0 reference clock, and each hop away adds one.

  • Which mark in show ntp associations shows the server a device is synchronised to?

    The asterisk marks that server.

  • What does a boundary clock do in PTP?

    It synchronises to a master on one port and acts as a master on its other ports.

Topic 9 of 13 in Infrastructure

Test yourself on Infrastructure

The full Cisco CCNP 350-401 ENCOR question bank has 854 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Cisco. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.