Add an NTP Server

Add a remote NTP server to the configuration by specifying its IP address or fully qualified domain name (FQDN). NTP adds the IP address to a list of servers, which the local NTP client uses to query remote time servers for time information. The list of qualified servers called to is a peer list.

Before you begin

If you specify an FQDN for the server, you must configure DNS for address resolution.

About this task

For NTPv4, this procedure adds the NTP server information to the switch that is acting as an NTP client. You can configure a maximum of 20 NTP servers.

Procedure

  1. Enter Global Configuration mode:

    enable

    configure terminal

  2. Add an NTP server:

    ntp server WORD<1–110>

  3. Configure additional options for the NTP server:

    ntp server WORD<1–110> [auth-enable] [authentication-key <0-65534>] [enable]

    The NTP server is automatically enabled by default.

  4. Confirm the configuration:

    show ntp server [name]

Examples

Configure a server using an IPv4 address:

Switch:>enable
Switch:1configure terminal
Switch:1(config)#ntp server 192.0.2.187 enable
Switch:1(config)#show ntp server

==========================================================================================
                                   NTP Server
==========================================================================================
Server Ip                                Enabled Auth    Key Id     Auth Type
------------------------------------------------------------------------------------------
192.0.2.187                              true    false   0          N/A

Configure a server using an FQDN:

Switch:>enable
Switch:1configure terminal
Switch:1(config)#ntp server host.example.com enable
Switch:1(config)#show ntp server
==========================================================================================
                                   NTP Server
==========================================================================================
Server Ip                                Enabled Auth    Key Id     Auth Type
------------------------------------------------------------------------------------------
host.example.com                         true    false   0          N/A

Variable Definitions

The following table defines parameters for the ntp server command.

Variable

Value

auth-enable

Activates MD5 or SHA1 authentication on this NTP server. Without this option, the NTP server will not have any authentication by default.

authentication-key <0-65534>

Specifies the key ID value used to generate the MD5 or SHA1 digest for the NTP server. The default authentication key is 0, which indicates disabled authentication.

enable

Activates the NTP server. To set this option to the default value, use the default operator with the command.

WORD<1–110>

Specifies the IPv4 address, IPv6 address, or fully qualified domain name (FQDN) of the NTP server. If you use an FQDN, you must also configure the switch to use DNS.

The following table defines parameters for the show ntp server command.

Variable

Value

name

Displays all NTP server names.