Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

header-navigation
keyboard_arrow_up
close
keyboard_arrow_left
Timing and Synchronization Guide
Table of Contents Expand all
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

NTP Configuration

date_range 20-Dec-24

The Network Time Protocol (NTP) provides the mechanisms to synchronize time and coordinate time distribution in a large, diverse network. Debugging and troubleshooting are much easier when the timestamps in the log files of all the routers or switches are synchronized, because events that span the network can be correlated with synchronous entries in multiple logs. We recommend using the Network Time Protocol (NTP) to synchronize the system clocks of routers, switches, and other network equipment.

To configure NTP:

  1. Configure Junos OS to retrieve the time when it first boots up.

    Use the boot-server statement with the IP address of your NTP server. If DNS is configured, you can use a domain name instead of an IP address.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set boot-server (name | ip-address)
    

    For example, set an IP address of 172.16.1.1 for your NTP server.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set boot-server 172.16.1.1
    

    For example, set a domain name. In this example, the domain name is provided by pool.ntp.org.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set boot-server 0.north-america.pool.ntp.org
    
  2. Specify the source address that the reply will always use, and the source address that requests initiated by NTP server will use, include the source-address statement at the [edit system ntp] hierarchy level.
    content_copy zoom_out_map
    [edit system ntp]
    user@host# set source-address source-address
    
    For example:
    content_copy zoom_out_map
    [edit system ntp]
    user@host# set source-address 10.0.10.100
  3. Specify one source address per family for each routing instance.
    content_copy zoom_out_map
    [edit system ntp source-address source-address
    user@host# set routing-instance routing-instance-name
    
    For example, the following statement is configured:
    content_copy zoom_out_map
    [edit system ntp source-address 10.0.10.100]
    user@host# set routing-instance ntp-instance
  4. (Optional) Configure one or more reference NTP servers to keep the device synchronized with periodic updates.

    It is a good practice to do this, as the Junos OS device can remain up for a long time, and therefore the clock can drift.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set server (name | ip-address)
    

    For example, set an IP address of 172.16.1.1 for your NTP server.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set server 172.16.1.1
    

    For example, set a domain name provided by pool.ntp.org.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set server 0.north-america.pool.ntp.org
    
  5. (Optional) Set the local time zone to match the device’s location.

    Universal Coordinated Time (UTC) is the default. Many administrators prefer to keep all their devices configured to use the UTC time zone. This approach has the benefit of allowing you to easily compare the time stamps of logs and other events across a network of devices in many different time zones.

    On the other hand, setting the time zone allows Junos OS to present the time in the correct local format.

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set time-zone time-zone
    

    For example:

    content_copy zoom_out_map
    [edit system ntp]
    user@host# set time-zone America/Los_Angeles
    
  6. Verify the configuration.

    Check the system uptime. This command provides the current time, when the device was last booted, when the protocols started, and when the device was last configured.

    content_copy zoom_out_map
    user@host> show system uptime
    Current time: 2013-07-25 16:33:38 PDT
    System booted: 2013-07-11 17:14:25 PDT (1w6d 23:19 ago)
    Protocols started: 2013-07-11 17:16:35 PDT (1w6d 23:17 ago)
    Last configured: 2013-07-23 12:32:42 PDT (2d 04:00 ago) by user
     4:33PM  up 13 days, 23:19, 1 user, load averages: 0.00, 0.01, 0.00

    Check the NTP server status and associations of the clocking sources used by your device.

    content_copy zoom_out_map
    user@host> show ntp associations
    
         remote           refid      st t when poll reach   delay   offset  jitter
    ==============================================================================
     tux.brhelwig.co .INIT.          16 -    -  512    0    0.000    0.000 4000.00
    
    content_copy zoom_out_map
    user@host > show ntp status
    status=c011 sync_alarm, sync_unspec, 1 event, event_restart,
    version="ntpd 4.2.0-a Thu May 30 19:14:15 UTC 2013 (1)",
    processor="i386", system="JUNOS13.2-20130530_ib_13_3_psd.1", leap=11,
    stratum=16, precision=-18, rootdelay=0.000, rootdispersion=5.130,
    peer=0, refid=INIT,
    reftime=00000000.00000000  Wed, Feb  6 2036 22:28:16.000, poll=4,
    clock=d59d4f2e.1793bce9  Fri, Jul 26 2013 12:40:30.092, state=1,
    offset=0.000, frequency=62.303, jitter=0.004, stability=0.000

    To configure NTP on the router or switch, include the ntp statement at the [edit system] hierarchy level:

    content_copy zoom_out_map
    [edit system]
    ntp {
        authentication-key number type type value password;
        boot-server (address | hostname);
        broadcast <address> <key key-number> <routing-instance-name routing-instance-name> <ttl value> <version value> ;
        broadcast-client;
        multicast-client <address>;
        peer address <key key-number> <version value> <prefer>;
        server address <key key-number> <version value> <prefer>;
        source-address <source-address> <routing-instance routing-instance-name>;
        trusted-key [ key-numbers ];
    }
    
footer-navigation