Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Configure NTP

This topic provides an example to configure NTP.

The Network Time Protocol (NTP) provides the mechanism to synchronize time and coordinate time distribution in a large, diverse network. NTP uses a returnable-time design in which a distributed subnet of time servers operating in a self-organizing, hierarchical primary-secondary configuration synchronizes local clocks within the subnet and to national time standards by means of wire or radio. The servers also can redistribute reference time using local routing algorithms and time daemons.

This example shows how to configure NTP:

Requirements

This example uses the following software and hardware components:

  • Junos OS Release 11.1 or later

  • A switch connected to a network on which an NTP boot server and NTP server reside

Overview

Debugging and troubleshooting are much easier when the timestamps in the log files of all switches are synchronized, because events that span a network can be correlated with synchronous entries in multiple logs. We recommend using the Network Time Protocol (NTP) to synchronize the system clocks of your switch and other network equipment.

In this example, an administrator wants to synchronize the time in a switch to a single time source. We recommend using authentication to make sure that the NTP peer is trusted. The boot-server statement identifies the server from which the initial time of day and date are obtained when the switch boots. The server statement identifies the NTP server used for periodic time synchronization. The authentication-key statement specifies that an HMAC-Message Digest 5 (MD5) scheme is used to hash the key value for authentication, which prevents the switch from synchronizing with an attacker’s host that is posing as the time server.

Configuration

To configure NTP:

Procedure

CLI Quick Configuration

To quickly configure NTP, copy the following commands and paste them into the switch’s terminal window:

Step-by-Step Procedure

To configure NTP :

  1. Specify the boot server:

  2. Specify the NTP server:

  3. Specify one source address per family for each routing-instance:

  4. Specify the key number, authentication type (MD5), and key for authentication:

Results

Check the results:

Verification

To confirm that the configuration is correct, perform these tasks:

Checking the Time

Purpose

Check the time that has been set on the switch.

Action

Enter the show system uptime operational mode command to display the time.

Meaning

The output shows that the current date and time are June 12, 2009 and 12:49:03 PDT. The switch booted 4 weeks, 6 hours, and 24 minutes ago, and its protocols were started approximately 3 minutes before it booted. The switch was last configured by user admin1 on May 27, 2009, and there is currently one user logged in to the switch.

The output also shows that the load average is 0.05 seconds for the last minute, 0.06 seconds for the last 5 minutes, and 0.01 seconds for the last 15 minutes.

Displaying the NTP Peers

Purpose

Verify that the time has been obtained from an NTP server.

Action

Enter the show ntp associations operational mode command to display the NTP server from switch obtained its time.

Meaning

The asterisk (*) in front of the NTP server name, or peer, indicates that the time is synchronized and obtained from this server. The delay, offset, and jitter are displayed in milliseconds.

Displaying the NTP Status

Purpose

View the configuration of the NTP server and the status of the system.

Action

Enter the show ntp status operational mode command to view the status of the NTP.

Meaning

The output shows status information about the switch and the NTP.