Time Configuration
此内容尚不支持你的语言。
Time View
Section titled “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
Section titled “show clock”[Command] show clock
[Purpose] Display the time zone and time of the system.
[View] Privileged User View
[Use Cases]
sonic# show clock2024-10-19 09:19:01 Tuesday UTC+0000show supported-timezones
Section titled “show supported-timezones”[Command] show supported-timezones
[Purpose] Display the time zones the system supports.
[View] Privileged User View
[Use Cases]
sonic# show supported-timezonesTime Config
Section titled “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
Section titled “clock datetime”[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# configuresonic(config)# clock datetime 2022-02-22 20:30:30clock timezone
Section titled “clock timezone”[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# configuresonic(config)# clock timezone Asia/ShangNTP(Network Time Protocol)is a protocol used to synchronize the time of individual machines on a network.
NTP View
Section titled “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
Section titled “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.198show ntp server
Section titled “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
Section titled “show ntp global”[Command] show ntp global
[Purpose] Display global configuration of NTP.
[View] Privileged User View
[Use Cases]
sonic# show ntp globalState: enabledAuthentication: disabledVRF: defaultshow ntp authentication-keyid
Section titled “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 yesNTP Config
Section titled “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
Section titled “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 enablentp server
Section titled “ntp server”[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.242ntp source_interface {mgmt|loopback|ethernet|link-aggregation|vlan}
Section titled “ntp source_interface {mgmt|loopback|ethernet|link-aggregation|vlan}”[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 0sonic(config)# ntp source_interface loopback 0ntp synchronize [unprivileged]
Section titled “ntp synchronize [unprivileged]”[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.24318 Nov 20:10:52 ntpdate[385097]: adjust time server 10.250.0.243 offset -0.009762 secntp synchronize jump
Section titled “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 jumpntp vrf {default|mgmt}
Section titled “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 defaultsonic(config)# ntp vrf mgmtntp authentication enable
Section titled “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 enablentp authentication-keyid
Section titled “ntp authentication-keyid”[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 md5Please enter authentication key value:sonic(config)#