---
title: Time Configuration
slug: aidc/time-configuration
createdAt: 2025-12-01T11:11:10.000Z
---

# <font color="#1d50a2">TIME</font>

## <font color="#1d50a2">Time View</font>

<font color="#1d05a2">Table 1 Time View</font>

| **Command**                  | **Purpose**                                   |
| ---------------------------- | --------------------------------------------- |
| **show clock**               | Display the time zone and time of the system. |
| **show supported-timezones** | Display the time zones the system supports.   |

### <font color="#1d50a2">show clock</font>

**\[Command]**
**show clock**

**\[Purpose]**
Display the time zone and time of the system.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show clock
2024-10-19 09:19:01 Tuesday UTC+0000
```

### <font color="#1d50a2">show supported-timezones</font>

**\[Command]**
**show supported-timezones**

**\[Purpose]**
Display the time zones the system supports.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show supported-timezones
```

## <font color="#1d50a2">Time Config</font>

<font color="#1d05a2">Table 2 Time Config</font>

| **Command**                    | **Purpose**               |
| ------------------------------ | ------------------------- |
| **clock datetime** *date time* | Set the system time.      |
| **clock timezone** *zone*      | Set the system time zone. |

### <font color="#1d50a2">clock datetime *date time*</font>

**\[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]**

```plaintext
sonic# configure
sonic(config)# clock datetime 2022-02-22 20:30:30
```

### <font color="#1d50a2">clock timezone *zone*</font>

**\[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]**

```plaintext
sonic# configure
sonic(config)# clock timezone Asia/Shang
```

# <font color="#1d50a2">NTP</font>

NTP(Network Time Protocol)is a protocol used to synchronize the time of individual machines on a network.

## <font color="#1d50a2">NTP View</font>

<font color="#1d05a2">Table 3 NTP View</font>

| **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.      |

### <font color="#1d50a2">show ntp</font>

**\[Command]**
**show ntp**

**\[Purpose]**
Display NTP status.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
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
```

### <font color="#1d50a2">show ntp server</font>

**\[Command]**
**show ntp server**

**\[Purpose]**
Display configuration of NTP Server.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ntp server
      SERVER    STATE    TYPE    KEY
------------  -------  ------  -----
10.250.0.242  enabled  server      -
10.250.0.243  enabled  server      -
```

### <font color="#1d50a2">show ntp global</font>

**\[Command]**
**show ntp global**

**\[Purpose]**
Display global configuration of NTP.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ntp global
State: enabled
Authentication: disabled
VRF: default
```

### <font color="#1d50a2">show ntp authentication-keyid</font>

**\[Command]**
**show ntp global**

**\[Purpose]**
Display NTP authentication key.

**\[View]**
Privileged User View

**\[Use Cases]**

```plaintext
sonic# show ntp authentication-keyid
  KEY ID    TYPE    TRUSTED
--------  ------  ---------
       1     md5        yes
```

## <font color="#1d50a2">NTP Config</font>

<font color="#1d05a2">Table 4 NTP Config</font>

| **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.                                               |

### <font color="#1d50a2">ntp enable</font>

**\[Command]**
**ntp enable**

**\[Purpose]**
Enable NTP automatic synchronization service.

**\[View]**
Global Configuration View

**\[Notes]**
Run command **no ntp enable** to disable NTP.

**\[Use Cases]**

```plaintext
sonic(config)# ntp enable
```

### <font color="#1d50a2">ntp server *server-ip* \[*authentication-keyid*\]</font>

**\[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]**

```plaintext
sonic(config)# ntp server 10.250.0.242
```

### <font color="#1d50a2">ntp source\_interface \{mgmt|loopback|ethernet|link-aggregation|vlan\} *interface\_name*</font>

**\[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]**

```plaintext
sonic(config)# ntp source_interface mgmt 0
sonic(config)# ntp source_interface loopback 0
```

### <font color="#1d50a2">ntp synchronize \[unprivileged\] *server-ip*</font>

**\[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]**

```plaintext
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
```

### <font color="#1d50a2">ntp synchronize jump</font>

**\[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]**

```plaintext
sonic(config)# ntp synchronize jump
```

### <font color="#1d50a2">ntp vrf \{default|mgmt\}</font>

**\[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]**

```plaintext
sonic(config)# ntp vrf default
sonic(config)# ntp vrf mgmt
```

### <font color="#1d50a2">ntp authentication enable</font>

**\[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]**

```plaintext
sonic(config)# ntp authentication enable
```

### <font color="#1d50a2">ntp authentication-keyid *key\_id* \{md5|sha1|sha256|sha384|sha512\}</font>

**\[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]**

```plaintext
sonic(config)# ntp authentication-keyid 1 md5
Please enter authentication key value:
sonic(config)#
```

