January 20, 201511 yr How to configure an NTP server and peer. BEFORE YOU BEGIN Make sure that you are in the correct VDC. To change the VDC, use the switchto vdc command. Make sure you know the IP address or DNS names of your NTP server and its peers. If you plan to use CFS to distribute your NTP configuration to other devices, then you should have already completed the following: –Enabled CFS distribution using the "Configuring CFS Distribution" section. –Enabled CFS for NTP using the "Enabling CFS Distribution for NTP" section. SUMMARY STEPS 1. config t 2. [no] ntp server {ip-address | ipv6-address | dns-name} [key key-id] [maxpoll max-poll] [minpoll min-poll] [prefer] [use-vrf vrf-name] 3. [no] ntp peer {ip-address | ipv6-address | dns-name} [key key-id] [maxpoll max-poll] [minpoll min-poll] [prefer] [use-vrf vrf-name] 4. (Optional) show ntp peers 5. (Optional) copy running-config startup-config DETAILED STEPS Step 1 config t Example: switch# config t Enter configuration commands, one per line. End with CNTL/Z. switch(config)# Places you in global configuration mode. Step 2 [no] ntp server {ip-address | ipv6-address | dns-name} [key key-id] [maxpoll max-poll] [minpoll min-poll] [prefer] [use-vrf vrf-name] Example: switch(config)# ntp server 192.0.2.10 Forms an association with a server. Use the key keyword to configure a key to be used while communicating with the NTP server. The range for the key-id argument is from 1 to 65535. Use the maxpoll and minpoll keywords to configure the maximum and minimum intervals in which to poll a peer. The range for the max-poll and min-poll arguments is from 4 to 16 seconds, and the default values are 6 and 4, respectively. Use the prefer keyword to make this the preferred NTP server for the device. Use the use-vrf keyword to configure the NTP server to communicate over the specified VRF. The vrf-name argument can be default, management, or any case-sensitive alphanumeric string up to 32 characters. Note If you configure a key to be used while communicating with the NTP server, make sure that the key exists as a trusted key on the device. For more information on trusted keys, see the "Configuring NTP Authentication" section. Step 3 [no] ntp peer {ip-address | ipv6-address | dns-name} [key key-id] [maxpoll max-poll] [minpoll min-poll] [prefer] [use-vrf vrf-name] Example: switch(config)# ntp peer 2001:0db8::4101 Forms an association with a peer. You can specify multiple peer associations. Use the key keyword to configure a key to be used while communicating with the NTP peer. The range for the key-id argument is from 1 to 65535. Use the maxpoll and minpoll keywords to configure the maximum and minimum intervals in which to poll a peer. The range for the max-poll and min-poll arguments is from 4 to 17 seconds, and the default values are 6 and 4, respectively. Use the prefer keyword to make this the preferred NTP peer for the device. Use the use-vrf keyword to configure the NTP peer to communicate over the specified VRF. The vrf-name argument can be default, management, or any case-sensitive alphanumeric string up to 32 characters. Step 4 show ntp peers Example: switch(config)# show ntp peers (Optional) Displays the configured server and peers. Note A domain name is resolved only when you have a DNS server configured. Step 5 copy running-config startup-config Example: switch(config)# copy running-config startup-config (Optional) Saves the change persistently through reboots and restarts by copying the running configuration to the startup configuration. This example shows how to configure an NTP server and peer: switch# config t Enter configuration commands, one per line. End with CNTL/Z. switch(config)# ntp server 192.0.2.10 key 10 use-vrf Red switch(config)# ntp peer 2001:0db8::4101 prefer use-vrf Red switch(config)# show ntp peers -------------------------------------------------- Peer IP Address Serv/Peer -------------------------------------------------- 2001:0db8::4101 Peer (configured) 192.0.2.10 Server (configured) switch(config)# copy running-config startup-config 100% switch(config)#
Create an account or sign in to comment