How to force NTP in Debian/Ubuntu to synchronize to IPv4 servers, not IPv6 (default \w both proto)
How to force NTP in Debian/Ubuntu to synchronize to IPv4 servers, not IPv6 (default \w both proto)After enabling IPv6 in the network, NTP daemon uses ipv6 DNS resolution to synchronize to ntp servers:
Code:
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
2001:b31:5c02:1 .INIT. 16 u - 64 0 0.000 0.000 0.000
2001:b31:5c02:1 .INIT. 16 u - 64 0 0.000 0.000 0.000
If this is not required, edit the "/etc/default/ntp" file and add the "-4" startup option for
ntpd so that it uses IPv4 dns resolution.
From "man ntpd":
Quote:
OPTIONS
-4, --ipv4 Force IPv4 DNS name resolution. This option must not appear
in combination with any of the following options: ipv6.
Force DNS resolution of following host names on the command
line to the IPv4 namespace.
-6, --ipv6 Force IPv6 DNS name resolution. This option must not appear
in combination with any of the following options: ipv4.
Force DNS resolution of following host names on the command
line to the IPv6 namespace.