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
-
If the NTP server requires authentication, define the authentication key for the NTP client with the command
ntp authentication
. -
Configure an NTP server with the command
ntp server
. -
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
. -
Review your NTP configuration settings with the commands
show ntp servers
andshow ntp status
. -
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