You are not logged in.

#1 2021-06-04 17:48:09

ryosan
Member
Registered: 2021-06-04
Posts: 4

Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

My machine supports both IPv4 / IPv6.
The network settings on my machine are set using systemd-networkd.

The NTP client on my machine uses systemd-timesyncd.

The NTP server referenced from systemd-timesyncd is specified in the systemd-networkd configuration file "/etc/systemd/network/****.network".

The contents of "/etc/systemd/network/****.network" are as follows (IPv4 address is hidden).

[Match]
Name = ens3

[Network]
DHCP = no

Address = ***.***.***.***/23
Gateway = ***.***.***.***
DNS = ***.***.***.***

IPv6Token = prefixstable

NTP = time1.facebook.com

For IPv6, the IPv6 address is set by SLAAC, and the IPv6 DNS server is set to RDNSS (Recursive DNS Server) included in RA (Router Advertisement).

The NTP server "time1.facebook.com" supports both IPv4 and IPv6, and the IPv4 address is "129.134.28.123" and the IPv6 address is "2a03:2880:ff0b::123".

When I ping "time1.facebook.com" on my machine, I ping the IPv6 address as follows.

# ping -c 1 time1.facebook.com
PING time1.facebook.com(time1.facebook.com (2a03:2880:ff0b::123)) 56 data bytes
64 bytes from time1.facebook.com (2a03:2880:ff0b::123): icmp_seq=1 ttl=57 time=0.490 ms

--- time1.facebook.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.490/0.490/0.490/0.000 ms

However, when referencing "time1.facebook.com" as an NTP server from systemd-timesyncd, it seems that the IPv4 address "129.134.28.123" is referenced from the result of the "timedatectl timesync-status" command below.

# timedatectl timesync-status
       Server: 129.134.28.123 (time1.facebook.com)
Poll interval: 34min 8s (min: 32s; max 34min 8s)
         Leap: normal
      Version: 4
      Stratum: 1
    Reference: FB
    Precision: 0 (-32)
Root distance: 152us (max: 5s)
       Offset: -11.319ms
        Delay: 562us
       Jitter: 5.223ms
 Packet count: 7
    Frequency: +18.085ppm

When I refer to "time1.facebook.com" as an NTP server from systemd-timesyncd, I want to change the setting so that it refers to the IPv6 address "2a03:2880:ff0b::123".

In such a case, what setting can I change to fulfill my wishes?

Offline

#2 2021-06-04 19:35:11

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 980

Re: Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

What is the content of your file /etc/systemd/timesyncd.conf? Referring to https://bugs.archlinux.org/task/59806 if you select the servers in the /etc/systemd/timesyncd.conf file appropriately then it will do what you are looking for. 

I have:

[Time]
NTP=2.arch.pool.ntp.org ntp1.npl.co.uk 0.pool.ntp.org 1.pool.ntp.org 
FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 3.arch.pool.ntp.org

this results in:

$ timedatectl timesync-status
       Server: 2a01:7e00::f03c:91ff:fead:69a (2.arch.pool.ntp.org)

Last edited by mcloaked (2021-06-04 19:45:38)


Mike C

Offline

#3 2021-06-05 03:35:54

ryosan
Member
Registered: 2021-06-04
Posts: 4

Re: Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

My file /etc/systemd/timesyncd.conf has the default values unchanged as below.

[Time]
#NTP=
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org

I modified the systemd-networkd configuration file "/etc/systemd/network/****.network" and removed the line "NTP = time1.facebook.com".

Then, I made the following changes to the file /etc/systemd/timesyncd.conf.

[Time]
NTP=time1.facebook.com
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org

After making the above changes and rebooting the server, the result is that the IPv4 address of "time1.facebook.com" is the referenced NTP server as shown below.

# timedatectl timesync-status
       Server: 129.134.28.123 (time1.facebook.com)

I think the problem this time is that the result of resolving the same FQDN "time1.facebook.com" is as follows.

ping command: IPv6 address (2a03:2880:ff0b::123)
systemd-timesyncd: IPv4 address (129.134.28.123)

Offline

#4 2021-06-05 09:44:25

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 980

Re: Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

What happens if you put 2.arch.pool.ntp.org as the first server in the NTP list in your timesyncd.conf file?  Does it work with that in place?  If it doesn't then perhaps the way the config files for the networking and dns are set up concerning how ipv6 vs ipv4 are prioritised may impact the outcome of which address the systemd-networkd time synchronisation uses, since it works in my case?

In my machine with a fixed up my networking file is:

$ cat /etc/systemd/network/50-wired.network
[Match]
Name=enp2s0

[Network]
Description=mymachine
Address=10.0.x.x/24
Gateway=10.0.y.yyy
DNS=10.0.x.x
Address=fd00:zzzz:zzzz:zzzz::z/64
IPv6PrivacyExtensions=true

So the networking works fine for both ip4 and ip6 on the local network and external ip6 addressing is supported by the isp. I don't know if there is an issue with the use of the facebook server rather than the setup but if your timesyncd.conf is using the same server that I am using but still won't look via ip6 then it must be something else in the configs that is leading to your system choosing ip4 for the time server.

By the way you could also try time rather than time1 for facebook time server:

$ host time.facebook.com
time.facebook.com has address 129.134.27.123
time.facebook.com has IPv6 address 2a03:2880:ff0a::123

Last edited by mcloaked (2021-06-05 10:21:20)


Mike C

Offline

#5 2021-06-06 10:29:53

ryosan
Member
Registered: 2021-06-04
Posts: 4

Re: Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

I made the following changes to the file /etc/systemd/timesyncd.conf.

# cat /etc/systemd/timesyncd.conf
[Time]
NTP=2.arch.pool.ntp.org
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org

After making the above changes and rebooting the server, the result is that the IPv4 address of "2.arch.pool.ntp.org" is the referenced NTP server as shown below.

# timedatectl timesync-status
       Server: 172.105.204.167 (2.arch.pool.ntp.org)

The result of ping is as follows.

# ping -c 1 2.arch.pool.ntp.org
PING 2.arch.pool.ntp.org(y.ns.gin.ntt.net (2001:418:3ff::1:53)) 56 data bytes
64 bytes from y.ns.gin.ntt.net (2001:418:3ff::1:53): icmp_seq=1 ttl=58 time=0.670 ms

--- 2.arch.pool.ntp.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.670/0.670/0.670/0.000 ms

Access to "time.facebook.com" will change to access to one of the following, perhaps elsewhere in the world:

time1.facebook.com
time2.facebook.com
time3.facebook.com
time4.facebook.com
time5.facebook.com

When I pinged the above 5 from my machine, the ping response time of "time1.facebook.com" was the best, so I use "time1.facebook.com" on my machine.

Offline

#6 2021-06-06 11:02:21

mcloaked
Member
From: Yorkshire, UK
Registered: 2012-02-02
Posts: 980

Re: Regarding systemd-timesyncd, handling of IPv4/IPv6 NTP server

OK I don't know what is different about your networking setup that makes your timesyncd use ip4 but what seems to be the same config with my system use ip6! Perhaps a user experienced with ip6 issues might be able to suggest what may have been set in your system that leads to that outcome.


Mike C

Offline

Board footer

Powered by FluxBB