当前位置:首页 > linux > 正文

linux ntp同步时间命令(linux ntp如何使用)

  • linux
  • 2024-03-15 21:00:55
  • 7323
Linux NTP 同步时间命令
NTP(网络时间协议)用于与网络时间服务器同步系统时间。
命令格式:
ntpd -s [选项] [服务器地址]
要素:
-s:
指定同步时间。
[选项]:
可选选项,用于指定同步方式和服务器信息。
-4:仅使用 IPv4
-6:仅使用 IPv6
-g:强制同步
[服务器地址]:
指定 NTP 服务器的地址。 可以使用服务器名称或 IP 地址。
示例:
同步到默认 NTP 服务器:
ntpd -s
同步到特定服务器:
ntpd -s 0.pool.ntp.org
同步到多个服务器:
ntpd -s 0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org
强制同步:
ntpd -sg 0.pool.ntp.org