[ntp:questions] Help with reference identifier for stratum 2 version 4.

Danny Mayer mayer at ntp.org
Wed Dec 16 03:59:16 UTC 2009

David Woolley wrote:
> Poster Matt wrote:
>>> It's an opaque hash of the identity of the server's upstream server. 
>>> New code is not supposed to put any further meaning on it.
>> Thanks David. But...
>> Then why does RFC 2030 say the reference identifier "contains the low 
>> order 32 bits of the last transmit timestamp received from the 
>> synchronization source."
> Version 4 NTP is still in draft and I think real version 4 servers tend 
> to implement the version 3 behaviour, so RFC 2030 was somewhat premature 
> in specifying version 4 behaviour.
> The problem with the version 3 behaviour is that it doesn't work well 
> with IPv6 addresses.  I think the insignificant bits in the timestamps 
> are now randomised, so an ntpd implementation seeing a packet with a 
> reference identifier that exactly matches the low order bits of a 
> timestamp it recently sent can be reasonably sure that it is seeing a loop.
> The current(?) draft for NTPV4 uses a hash, in the way I described: 
> <http://www.ietf.org/id/draft-ietf-ntp-ntpv4-proto-13.txt>, bottom of 
> page 23.  It behaves the same as NTPV3 when using IPV4 addresses.

Dave Mills and I have argued somewhat over this over the last few years.
The refid for a system is either the IPv4 address of the system or a
digest of the IPv6 address. See the function addr2refid() in
a_md5encypt.c in the reference implementation.

The controversy arises because a system may well have more than one IPv4
address and will certainly have more than one IPv6 address but it uses
the address it's using to send out the packet. The refid is essentially
used just for loop prevention but by having more than one address on
your system you are not really preventing loops. The system needs to
have just one refid to prevent loops so it really needs to use the same
id for all connections. Also a refid is just a number and has no meaning
beyond that. People have used the refid to find the stratum parent but
this is a dangerous assumption.

For SNTP you should take a look at the sntp implementation in the
reference implementation for ideas and to understand the implementation


This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

More information about the questions mailing list