Setting switch time using the NTP client

Prerequisites
  • The IP address or domain name of an NTP server.
  • If the NTP server uses authentication, obtain the password required to communicate with the NTP server.
Procedure
  1. If the NTP server requires authentication, define the authentication key for the NTP client with the command ntp authentication.
  2. Configure an NTP server with the command ntp server.
  3. By default, NTP traffic is sent on the default VRF. If you want to send NTP traffic on the management VRF, use the command ntp vrf.
  4. Review your NTP configuration settings with the commands show ntp servers and show ntp status.
  5. See the current switch time, date, and time zone with the command show clock.

Example

This example creates the following configuration:

  • Defines the authentication key 1 with the password myPassword.
  • Defines the NTP server my-ntp.mydomain.com and makes it the preferred server.
  • Sets the switch to use the management VRF (mgmt) for all NTP traffic.
switch(config)# ntp authentication-key 1 md5 myPassword
switch(config)# ntp server my-ntp.mydomain.com key 10 prefer
switch(config)# ntp vrf mgmt