Command Line Reference
System Configuration
Time Configuration
24 min
time time time view time view table 1 time view table 1 time view command purpose show clock display the time zone and time of the system show supported timezones display the time zones the system supports show clock show clock \[command] show clock \[purpose] display the time zone and time of the system \[view] privileged user view \[use cases] sonic# show clock 2024 10 19 09 19 01 tuesday utc+0000 show supported timezones show supported timezones \[command] show supported timezones \[purpose] display the time zones the system supports \[view] privileged user view \[use cases] sonic# show supported timezones time config time config table 2 time config table 2 time config command purpose clock datetime date time set the system time clock timezone zone set the system time zone clock datetime clock datetime date time \[command] clock datetime date time \[purpose] set the system time \[parameters] parameter description date in yy mm dd format time in hh\ mm\ ss format \[view] global configuration view \[use cases] sonic# configure sonic(config)# clock datetime 2022 02 22 20 30 30 clock timezone clock timezone zone \[command] clock timezone zone \[purpose] set the system time zone \[parameters] parameter description zone the default time zone is utc \[view] global configuration view \[notes] run command no clock timezone to restore the system time zone to default \[use cases] sonic# configure sonic(config)# clock timezone asia/shang ntp ntp ntp(network time protocol)is a protocol used to synchronize the time of individual machines on a network ntp view ntp view table 3 ntp view table 3 ntp view command purpose show ntp display ntp status show ntp server display configuration of ntp server show ntp global display global configuration of ntp show ntp authentication keyid display ntp authentication key show ntp show ntp \[command] show ntp \[purpose] display ntp status \[view] privileged user view \[use cases] sonic# show ntp remote refid st t when poll reach delay offset jitter \============================================================================== 10 250 0 240 203 107 6 88 3 u 46 64 377 0 165 10 575 3 198 show ntp server show ntp server \[command] show ntp server \[purpose] display configuration of ntp server \[view] privileged user view \[use cases] sonic# show ntp server server state type key \ 10 250 0 242 enabled server 10 250 0 243 enabled server show ntp global show ntp global \[command] show ntp global \[purpose] display global configuration of ntp \[view] privileged user view \[use cases] sonic# show ntp global state enabled authentication disabled vrf default show ntp authentication keyid show ntp authentication keyid \[command] show ntp global \[purpose] display ntp authentication key \[view] privileged user view \[use cases] sonic# show ntp authentication keyid key id type trusted \ 1 md5 yes ntp config ntp config table 4 ntp config table 4 ntp config command purpose ntp enable enable ntp automatic synchronization service ntp server server ip \[ authentication keyid ] specify a ntp server ntp source interface {mgmt|loopback|ethernet|link aggregation|vlan} interface name specify the source interface for ntp ntp synchronize \[unprivileged] server ip synchronise manually from an ntp server ntp synchronize jump enable ntp jump synchronization ntp vrf {default|mgmt} specify the vrf where the ntp source interface is located ntp authentication enable enable ntp authentication ntp authentication keyid key id {md5|sha1|sha256|sha384|sha512} add ntp key ntp enable ntp enable \[command] ntp enable \[purpose] enable ntp automatic synchronization service \[view] global configuration view \[notes] run command no ntp enable to disable ntp \[use cases] sonic(config)# ntp enable ntp server ntp server server ip \[ authentication keyid ] \[command] ntp server server ip \[ authentication keyid ] \[purpose] specify a ntp server \[parameters] parameter description server ip |ntp server ip address or domain name authentication keyid | \[view] global configuration view \[notes] run command no ntp server server ip to delete ntp server configuration \[use cases] sonic(config)# ntp server 10 250 0 242 ntp source interface {mgmt|loopback|ethernet|link aggregation|vlan} ntp source interface {mgmt|loopback|ethernet|link aggregation|vlan} interface name \[command] ntp source interface { mgmt|loopback|ethernet|link aggregation|vlan } interface name \[purpose] specify the source interface for ntp \[parameters] parameter description interface name interface name (eg 0/1) when specify mgmt the interface name is 0 \[view] global configuration view \[notes] run command no ntp source interface to delete ntp source interface configuration \[use cases] sonic(config)# ntp source interface mgmt 0 sonic(config)# ntp source interface loopback 0 ntp synchronize \[unprivileged] ntp synchronize \[unprivileged] server ip \[command] ntp synchronize \[ unprivileged ] server ip \[purpose] synchronise manually from an ntp server \[parameters] parameter description unprivileged this parameter should be enabled when the ntp auto sync service is already running so that manual synchronisation can be performed over an unprivileged port server ip specify ntp server ip address \[view] global configuration view \[notes] when you run this command, the system will immediately synchronise to ntp server time this command is valid for a single time and will not be saved to running config \[use cases] sonic(config)# ntp synchronize unprivileged 10 250 0 243 18 nov 20 10 52 ntpdate\[385097] adjust time server 10 250 0 243 offset 0 009762 sec ntp synchronize jump ntp synchronize jump \[command] ntp synchronize jump \[purpose] enable ntp jump synchronization \[view] global configuration view \[notes] with this command set, the system will make a time adjustment with a large offset every time the process restarts by default a jump synchronization will be made only when the offset is over 600 seconds \[use cases] sonic(config)# ntp synchronize jump ntp vrf {default|mgmt} ntp vrf {default|mgmt} \[command] ntp vrf { default|mgmt } \[purpose] specify the vrf where the ntp source interface is located \[view] global configuration view \[notes] when you have set the management port as ntp source interface as and enabled management vrf, please specify mgmt as ntp vrf by default, the ntp vrf is default vrf \[use cases] sonic(config)# ntp vrf default sonic(config)# ntp vrf mgmt ntp authentication enable ntp authentication enable \[command] ntp authentication enable \[purpose] enable ntp authentication \[view] global configuration view \[notes] run command no ntp authentication enable to disable ntp authentication \[use cases] sonic(config)# ntp authentication enable ntp authentication keyid ntp authentication keyid key id {md5|sha1|sha256|sha384|sha512} \[command] ntp authentication keyid key id {md5|sha1|sha256|sha384|sha512} \[purpose] add ntp key \[view] global configuration view \[notes] run command no ntp authentication keyid key id to delete ntp key \[use cases] sonic(config)# ntp authentication keyid 1 md5 please enter authentication key value sonic(config)#
