You do not have permission to edit this page, for the following reason: The action you have requested is limited to users in the group: Users. You can view and copy the source of this page. __FORCETOC__ === ntp === The Network Time Protocol (NTP) is a networking protocol for clock synchronization between computer systems over packet-switched, variable-latency data networks.<ref>https://en.wikipedia.org/wiki/Network_Time_Protocol</ref> ==== Verifying NTP ==== To verify the NTP servers, enter <code>show ntp server</code> in the user mode. LYSH@MyHostName# show ntp servers To show the status of the Time synchronization, <code>show ntp status</code> in the user mode. It shows the status of, when, and where the time was synchronized. <pre> LYSH@MyHostName# show ntp status ● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-04-27 13:12:30 KST; 10s ago Docs: man:systemd-timesyncd.service(8) Main PID: 18992 (systemd-timesyn) Status: "Connecting to time server [2001:67c:1560:8003::c8]:123 (ntp.ubuntu.com)." Tasks: 2 (limit: 9387) Memory: 1.6M CGroup: /system.slice/systemd-timesyncd.service └─18992 /lib/systemd/systemd-timesyncd </pre> You can also verify the Time synchronization by using the <code>show datetime</code> commmand. <pre> LYSH@MyHostName# show datetime Local time: Tue 2021-04-27 13:32:46 KST Universal time: Tue 2021-04-27 04:32:46 UTC RTC time: Tue 2021-04-27 04:32:46 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no </pre> ==== add / delete ==== You can configure the NTP servers. Note that the system has already an NTP server that is "ntp.ubuntu.com". If you add an NTP server, the system synchronizes the time using added NTP server. If the Time synchronization failed from a server, the system tries to the next server. <pre> LYSH@MyHostName# configure configure# ntp add asia.pool.ntp.org configure# exit LYSH@MyHostName# show ntp servers NTP Servers : asia.pool.ntp.org </pre> You can see the status of the time synchronization to a time server by the <code>show ntp status</code> command. If the "Status" shows "Idle", it indicates the system couldn't synchronize to one of the NTP servers. <pre> LYSH@MyHostName# show ntp status ● systemd-timesyncd.service - Network Time Synchronization Loaded: loaded (/lib/systemd/system/systemd-timesyncd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2021-04-27 13:10:36 KST; 12s ago Docs: man:systemd-timesyncd.service(8) Main PID: 18321 (systemd-timesyn) Status: "Initial synchronization to time server 157.119.108.165:123 (asia.pool.ntp.org)." Tasks: 2 (limit: 9387) Memory: 1.6M CGroup: /system.slice/systemd-timesyncd.service └─18321 /lib/systemd/systemd-timesyncd </pre> To remove one of the NTP servers, enter the <code>ntp delete {ntp-server-name}</code> in the configuration mode. <pre> LYSH@MyHostName# configure configure# ntp delete asia.pool.ntp.org configure# exit </pre> ==== enable / disable ==== You can disable the System clock synchronizing using the NTP server. <pre> LYSH@MyHostName# configure configure# ntp disable Local time: Tue 2021-04-27 10:26:03 KST Universal time: Tue 2021-04-27 01:26:03 UTC RTC time: Tue 2021-04-27 01:26:03 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: no NTP service: inactive RTC in local TZ: no </pre> You can also enable it. Note that the status of the "System clock synchronized" may show "inactive" for a while after enabling the NTP and the status will be changed to "active" in few seconds. <pre> LYSH@MyHostName# configure configure# ntp enable Local time: Tue 2021-04-27 10:26:03 KST Universal time: Tue 2021-04-27 01:26:03 UTC RTC time: Tue 2021-04-27 01:26:03 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: active NTP service: active RTC in local TZ: no </pre> === datetime === To show the system time and date, enter the <code>show datetime</code> command. <pre> LYSH@MyHostName# show datetime Local time: Tue 2021-04-27 13:32:46 KST Universal time: Tue 2021-04-27 04:32:46 UTC RTC time: Tue 2021-04-27 04:32:46 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no </pre> To change the system time and date, enter the <code>datetime {format}</code>. The format must be 'yyyy-mm-dd hh24:mi:ss'.<br> Note that if you manually change the system time and date while the NTP is enabled, you encounter the "''Failed to set time: Automatic time synchronization is enabled''" error. Therefore you need to disable the NTP before configuring the system time and date manually. LYSH@MyHostName# configure configure# datetime 2021-04-27 13:00:00 Local time: Tue 2021-04-27 13:00:00:49 KST Universal time: Tue 2021-04-27 04:00:00 UTC RTC time: Tue 2021-04-27 04:00:00 Time zone: Asia/Seoul (KST, +0900) System clock synchronized: yes NTP service: active RTC in local TZ: no === References === Template used on this page: Template:Note (view source) Return to CLI - NTP.