===== Настройка службы синхронизации времени systemd-timesyncd в Debian GNU/Linux 11 (Bullseye) ===== {{:unix-linux:debian:pasted:20171124-194401.png }} В составе версии **systemd**, используемой в конфигурации по умолчанию в **Debian GNU/Linux 11** имеется отдельная служба, отвечающая за синхронизацию времени локальной системы по протоколу **NTP** с внешними NTP-серверами - **systemd-timesyncd**. Поэтому, если нужно настроить синхронизацию времени, например, с корпоративными NTP-серверами, нет необходимости устанавливать и настраивать специальные пакеты типа **ntp**, а достаточно лишь выполнить настройку **systemd-timesyncd**. Проверить текущее состояние службы можно командой
# systemctl status systemd-timesyncd
В свеже установленной ОС Debian Bullseye служба systemd-timesyncd будет запускаться автоматически. Отредактируем основной конфигурационный файл **systemd-timesyncd**:
# nano /etc/systemd/timesyncd.conf
# This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See timesyncd.conf(5) for details. [Time] NTP=ntp1.holding.com dc1.holding.com dc2.holding.com #FallbackNTP=0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org #RootDistanceMaxSec=5 #PollIntervalMinSec=32 #PollIntervalMaxSec=2048 После правки конфигурационной файла перезапускаем службу и проверяем её состояние:
# systemctl restart systemd-timesyncd
# systemctl status systemd-timesyncd
Состояние синхронизации времени можно проверить утилитой **timedatectl**:
# timedatectl status
Local time: Thu 2022-03-17 15:19:31 MSK Universal time: Thu 2022-03-17 12:19:31 UTC RTC time: Thu 2022-03-17 12:19:30 Time zone: Europe/Moscow (MSK, +0300) System clock synchronized: yes NTP service: active RTC in local TZ: no
Посмотреть лог службы **systemd-timesyncd** (как юнита **systemd**) можно следующей командой:
# journalctl -u systemd-timesyncd --since today

Mar 17 15:15:13 SRV1 systemd[1]: Starting Network Time Synchronization... Mar 17 15:15:13 SRV1 systemd[1]: Started Network Time Synchronization. Mar 17 15:15:13 SRV1 systemd-timesyncd[977]: Initial synchronization to time server 10.1.0.4:123 (ntp1.holding.com).
Если же всё таки возникает необходимость использования других пакетов синхронизации времени, то можно остановить и отключить службу **systemd-timesyncd** парой простых команд:
# systemctl stop systemd-timesyncd
# systemctl disable systemd-timesyncd
---- Дополнительные источники информации: * [[https://www.freedesktop.org/software/systemd/man/timesyncd.conf.html|man timesyncd.conf]] * [[https://wiki.archlinux.org/index.php/Systemd-timesyncd_(%D0%A0%D1%83%D1%81%D1%81%D0%BA%D0%B8%D0%B9)|wiki archlinux - systemd-timesyncd]] ---- Проверено на следующих конфигурациях: ^ Версия ОС ^ Версия systemd ^ |Debian GNU/Linux Bullseye 11.2 | 247.3-6 amd64 | ---- {{:user:blogroot.png?50&nolink |}} Автор первичной редакции:\\ [[user:blogroot|Алексей Максимов]] \\ Время публикации: 17.03.2022 15:22 {{tag>Linux Debian "Debian 11" "Debian Bullseye" NTP systemd systemd-timesyncd timesyncd timedatectl}} ~~DISCUSSION~~