NTP Configuration Commands I Table of Contents Table of Contents Chapter 1 NTP Configuration Commands....................................................................................................1 1.1 ntp master...........................................................................................................................................1 1.2 ntp authentication enable................................................................................................................. 2 1.3 ntp authentication key.......................................................................................................................3 1.4 ntp authentication trusted-key..........................................................................................................4 1.5 ntp server............................................................................................................................................ 5 1.6 ntp peer............................................................................................................................................... 6 1.7 show ntp..............................................................................................................................................7 1.8 debug ntp............................................................................................................................................ 8 1.9 time-zone............................................................................................................................................ 9 II NTP Configuration Commands Chapter 1 NTP Configuration Commands 1.1 ntp master Syntax To set the device as the original NTP server (stratum=1), run the following command. ntp master primary To set the device as the secondary NTP server, run the following command. ntp master secondary To disable NTP server, run the following command. no ntp master Parameters None Default Value None Command Mode Global configuration mode Usage Guidelines If the device is not configured with NTP server (ntp server command is not configured), ntp master primary command must be configured. Or the switch cannot provide time synchronization service. ntp master secondary command must be run when the switch configures NTP server. Moreover, the switch can provide time synchronization service to the NTP client in condition its own time synchronization is realized. Example Switch_config#ntp master primary Switch_config#ntp master secondary Switch_config#no ntp master 1 NTP Configuration Commands Related Command ntp server ntp peer 1.2 ntp authentication enable Syntax To enable NTP identity authentication, run the following command. ntp authentication enable To return to the default setting, use the no form of this command. no ntp authentication enable Parameters None Default Value Disabled Command Mode Global configuration mode Usage Guidelines For a secure network, NTP identity authentication must be enabled when operating NTP protocol. The identity authentication ensures that the client only realize time synchronization with the server which passes the identity authentication. Thus, the client will not obtain error time information from the illegal server. Example Switch_config#ntp authentication enable Related Command ntp authentication key ntp authentication trusted-key 2 NTP Configuration Commands 1.3 ntp authentication key To set NTP identity authentication key, run the first one of the following commands. ntp authentication key keyid md5 password To return to the default setting, use the no form of this command. no ntp authentication key keyid Parameters Parameters Description keyid The serial number of the authentication key. The value ranges from 1 to 4294967295. password The key of keyed. The length ranges from 1 to 50. Default Value None Command Mode Global configuration mode Usage Guidelines The command is used to set identity authentication key. The client and the server must set the same key serial number and key value, or they cannot realize time synchronization. After set NTP authentication key, Set the key as the trusted key by command ntp authentication trusted-key. The trusted key will automatically disappear from the trusted key list when it is deleted. There is no need to run command “no ntp authentication trusted-key”. The command can set multiple ntp authentication key commands. Example Switch_config#ntp authentication key 5 md5 abc123 Switch_config#no ntp authentication key 5 Related Command ntp authentication enable ntp authentication trusted-key 3 NTP Configuration Commands 1.4 ntp authentication trusted-key To set the created key as the trusted key, run the first one of the following commands. ntp authentication trusted-key keyid To return to the default setting, use the no form of this command. no ntp authentication trusted-key keyid Parameters Parameters Description keyid The serial number of the authentication key. The value ranges from 1 to 4294967295. Default Value None Command Mode Global configuration mode Usage Guidelines Enable the identity authentication function, the client can only time synchronize with the server providing the trusted key. If the key provided by the server is not trusted, the client cannot synchronize to the NTP server. The command must be configured after the key is set. The trusted key will automatically disappear from the trusted key list when it is deleted. There is no need to run command “no ntp authentication trusted-key”. Example Switch_config#ntp authentication trusted-key 5 Switch_config#no ntp authentication trusted-key 5 Related Command ntp authentication enable ntp authentication key 4 NTP Configuration Commands 1.5 ntp server Parameters To set NTP server, run the following command. ntp server ip-address [version number | key keyid]* To return to the default setting, use the no form of this command. no ntp server ip-address Parameters Parameters Description ip-address NTP Server IP address number NTP version number, the value ranges from: <1-4>, the default value is 4. keyid When sending NTP packets to the NTP server, calculate the packet information abstract with the key corresponds to the keyid. The value ranges from 1 to 4294967295. If the parameter is not set, the device will not authenticate the identity of the server, or vice verse. Default Value None Command Mode Global configuration mode Usage Guidelines After a NTP server is set, the device can time synchronize with the server, but the server time will not synchronize to the device. Multiple ntp server commands can be configured. If using the NTP server on the public network, you have to configured at least 4 different NTP severs, so that the error clock source can be expelled. Example Switch_config#ntp server 1.1.1.1 version 4 key 5 5 NTP Configuration Commands Related Command ntp authentication enable ntp authentication key ntp authentication trusted-key 1.6 ntp peer To set a NTP peer for the device, run the following command. ntp peer ip-address [version number | key keyid]* To return to the default setting, use the no form of this command. no ntp peer ip-address Parameters Parameters Description ip-address NTP peer IP address number NTP version number, the value ranges from: <1-4>, the default value is 4. keyid When sending NTP packets to the NTP peer, calculate the packet information abstract with the key corresponds to the keyid. The value ranges from 1 to 4294967295. If the parameter is not set, the device will not authenticate the identity of the peer, or vice verse. Default Value None Command Mode Global configuration mode Usage Guidelines The command is used to set the NTP peer and synchronize the time of the peer to the device provided that the peer time is synchronized. The command is often used as backup between the NTP servers. The device as the client is usually not configure the command. The command ntp server is used to set the NTP server. Example Switch_config#ntp peer 1.1.1.2 version 3 key 5 6 NTP Configuration Commands Related Command ntp authentication enable ntp authentication key ntp authentication trusted-key 1.7 show ntp To show NTP current status, run the following command. show ntp [status] To show NTP association status, run the following command. show ntp associations [detail] To show NTP timer status, run the following command. show ntp timers Parameters None Default Value None Command Mode EXEC Usage Guidelines Show NTP relevant information Example Switch#show ntp Time-zone: GMT+8:00, Shanghai Current time: 2014-05-21 10:45:26 Clock Status: synchronized Clock Stratum: 3 Leap Indicator: 0 7 NTP Configuration Commands Reference ID: 211.233.84.186 Clock Jitter: 0.004149 Clock Precision: -18 Clock Offset: 6.561 ms Root Delay: 172.153 ms Root Dispersion: 587.873 ms Packets Sent: 30788 Packets Received: 27969 (bad version: 0) Reference Time: 2014-05-21 10:41:37 Last Update Time: 2014-05-21 10:37:08 Switch#show ntp associations ip address reference clock st poll reach delay offset dispersion ==================================================================== 61.110.197.50 204.123.2.5 2 64 377 59.99 0.96 2.7 27.114.150.12 193.190.230.65 2 64 377 489.97 -34.56 3.1 *211.233.84.186 204.123.2.5 2 64 377 19.99 9.15 3.0 198.55.111.50 216.229.0.50 3 64 377 229.98 -40.09 3.4 199.241.31.224 132.163.4.103 2 64 377 198.04 2.51 3.6 204.2.134.163 241.199.164.101 2 64 360 169.97 -17.16 942.8 ==================================================================== Note: * system peer(master), poll(s), delay(ms), offset(ms), dispersion(ms) Total Associations: 6 Related Command None 1.8 debug ntp To enable NTP packet debug switch, run the following command. debug ntp packet To enable NTP event debug switch, run the following command. debug ntp event To enable NTP error debug switch, run the following command. debug ntp error To enable NTP all debug switches, run the following command. debug ntp all 8 NTP Configuration Commands To disable all debug switches, run the following command. no debug ntp Parameters None Default Value None Command Mode EXEC Usage Guidelines Check NTP running process by debug information. Example None Related Command None 1.9 time-zone To enable time zone function, run the following command. time-zone name offset-hour [offset-minute] To return to the default setting, use the no form of this command. no time-zone Parameters Parameters Description name Stands for the name of a time zone. offset-hour Hour off-set of local time to UTC time (-12~12) offset-minute Minute offset of local time to UTC time (0~59); the default value is 0. 9 NTP Configuration Commands Default Value None Command Mode Global configuration mode Usage Guidelines The command is used to transfer UTC to the local time. Example Switch_config#time-zone Beijing 8 Related Command None 10