Я настраиваю ntp в корпоративной сети.
Я сделал
restrict default ignore
restrict -6 default ignore
и перечисленный server
s явно (я использую общедоступные серверы от pool.ntp.org
). Я также не включил broadcastclient
.
Через некоторое время, ntpq -p
продолжает показывать только конкретный сервер в локальной сети, которую я не добавил в конфигурационном файле.
Не был должен restrict default ignore
заставить ntpd проигнорировать все пакеты с серверов, не явно упомянутых?
Я проверил серверы, с которыми я использую dig
, и адреса кажутся корректными.
Вот ntpq -pn
:
remote refid st t when poll reach delay offset jitter
==============================================================================
10.200.10.253 .INIT. 16 u - 64 0 0.000 0.000 0.000
И мой ток ntp.conf
(удаленные комментарии)
driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
server 2.europe.pool.ntp.org
restrict default ignore
restrict -6 default ignore
restrict 2.europe.pool.ntp.org nomodify
restrict 127.0.0.1
restrict ::1
После некоторой отладки и помощи Аарона
я обнаружил проблему.
DHCP-клиент ISC по умолчанию получает информацию о серверах ntp в Debian .
Сценарий инициализации Debian ntpd
заставляет его использовать эту информацию, расширяя с ней /etc/ntp.conf
. Полученный файл доступен по адресу /var/lib/ntp/ntp.conf.dhcp
.
Решением, конечно же, является правильная настройка DHCP, чтобы не получать серверы ntp (просто удалите ntp-servers
в /etc/dhcp/dhclient.conf
).
Дополнительная информация доступна на странице поддержки NTP, раздел 6.12 :
ISC's dhcp is able to automatically configure the servers used by ntpd.
Here's how to get it working:
The dhcp server you are using must be configured to provide
the ntp-servers option
Configure your dhclient to request ntp-servers (it doesn't by default).
To do this add ntp-servers to the default request line in
/etc/dhcp3/dhclient.conf
Create an /etc/ntp.conf with all of the other settings that you wish to use.
This file will be used to create /etc/ntp.conf.dhcp, it won't be over written.
Your ntpd must be told to use /etc/ntp.conf.dhcp if it exists.
This is usually accomplished in the ntp init script (e.g. /etc/init.d/ntp).