home *** CD-ROM | disk | FTP | other *** search
/ Unix System Administration Handbook 1997 October / usah_oct97.iso / rfc / 700s / rfc778.txt < prev    next >
Text File  |  1992-10-14  |  9KB  |  226 lines

  1. RFC 778
  2.  
  3.  
  4.  
  5.                 DCNET Internet Clock Service
  6.               D.L. Mills, COMSAT Laboratories
  7.                        18 April 1981
  8.  
  9.  
  10. Introduction
  11.  
  12.      Following  is  a  description  of  the  Internet  Clock
  13. Service  (ICS)  provided  by  all DCNET hosts.  The service,
  14. intended primarily for  clock  synchronization  and  one-way
  15. delay  measurements  with  cooperating  internet  hosts,  is
  16. provided using the Timestamp and Timestamp Reply messages of
  17. the  proposed  Internet Control Message Protocol (ICMP).  In
  18. addition, in order to maintain  compatability  with  present
  19. systems,  this  service  will be provided for a limited time
  20. using  the   Echo   and   Echo   Reply   messages   of   the
  21. Gateway-Gateway Protocol (GGP).
  22.      It should be understood that ICMP and GGP datagrams are
  23. normally  considered  tightly bound to the Internet Protocol
  24. (IP) itself and not directly accessable to  the  user  on  a
  25. TOPS-20  system,  for  example.  These datagrams are treated
  26. somewhat differently from user  datagrams  in  gateways  and
  27. DCNET hosts in that certain internal queueing mechanisms are
  28. bypassed.  Thus, they can be a useful tool in providing  the
  29. most   accurate   and  stable  time  reference.   The  prime
  30. motivation for this note is to promote  the  development  of
  31. this  service  in  other internet hosts and gateways so that
  32. the feasibility for its use thoughout the community  can  be
  33. assessed.
  34.  
  35. ICS Datagrams and Timestamps
  36.  
  37.      At present, the ICS is provided using  either  ICMP  or
  38. GGP  datagrams.   The  only difference between these is that
  39. ICMP uses protocol number 1 and GGP uses protocol number  3.
  40. In the following these will be referred to interchangably as
  41. ICS datagrams.  ICS datagrams  include  an  internet  header
  42. followed by an ICS header in the following format:
  43.  
  44. DCNET Internet Clock Service                        PAGE   2
  45.  
  46.  
  47.  
  48.  0                   1                   2                   3
  49.  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  50. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  51. |      Type     |     Code      |            Sequence           |
  52. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  53. |                      Originate Timestamp                      |
  54. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  55. |                       Receive Timestamp                       |
  56. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  57. |                       Transmit Timestamp                      |
  58. +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  59.  
  60.                        ICS Datagram Format
  61.  
  62.      The originator fills in all three timestamp fields just
  63. before  the datagram is forwarded to the net.  Each of these
  64. fields contain the local time at origination.  Although  the
  65. last   two   are   redundant,  they  allow  roundtrip  delay
  66. measurements  to  be  made  using   remote   hosts   without
  67. timestamping  facilities.   The "Type" field can be either 8
  68. (GGP Echo) or 13 (ICMP Timestamp).  The "Code" field  should
  69. be zero.  The "Sequence" field can contain either zero or an
  70. optional sequence number provided by the user.   The  length
  71. of  the datagram is thus 36 octets inclusive of the 20-octet
  72. internet header and exclusive of the local-network leader.
  73.  
  74.      The host or gateway receiving an ICS datagram fills  in
  75. the  "Receive  Timestamp"  field  just  as  the  datagram is
  76. received from the net and the "Transmit Timestamp"  just  as
  77. it is forwarded back to the sender.  It also sets the "Type"
  78. field to 0 (GGP Echo Reply), if the original value was 8, or
  79. 14  (ICMP  Timestamp  Reply),  if  it was 13.  The remaining
  80. fields are unchanged.
  81.  
  82.      The timestamp values are in milliseconds from  midnight
  83. UT and are stored right-justified in the 32-bit fields shown
  84. above.  Ordinarily,  all  time  calculations  are  performed
  85. modulo-24 hours in milliseconds.  This provides a convenient
  86. match to those operating systems  which  maintain  a  system
  87. clock  in ticks past midnight.  The specified timestamp unit
  88. of milliseconds is consistent with the accuracy of  existing
  89. radio  clocks  and  the  errors expected in the timestamping
  90. process itself.
  91.  
  92. Delay Measurements
  93.  
  94.      Delay measurements can be made with any DCNET  host  by
  95. simply sending an ICS datagram in the above format to it and
  96. processing the reply.  Let t1, t2 and t3 represent the three
  97. timestamp  fields  of  the reply in order and t4 the time of
  98. arrival at the original sender.  Then the delays,  exclusive
  99. of  internal  processing  within  the DCNET host, are simply
  100. (t2 - t1) to the DCNET host, (t4 - t3) for  the  return  and
  101.  
  102. DCNET Internet Clock Service                        PAGE   3
  103.  
  104.  
  105.  
  106. (t2 - t1) + (t4 - t3)  for the roundtrip.  Note that, in the
  107. case of the roundtrip, the clock offsets between the sending
  108. host and DCNET host cancel.
  109.  
  110.      Although ICS datagrams are returned by all DCNET  hosts
  111. regardless  of  other connections that may be in use by that
  112. host at any given time, the most useful host  will  probably
  113. be   the   COMSAT-WWV   virtual  host  at  internet  address
  114. [29,0,9,2], which is also the  internet  echo  virtual  host
  115. formerly  called  COMSAT-ECH.  This virtual host is resident
  116. in  the  COMSAT-GAT  physical  host  at   internet   address
  117. [29,0,1,2], which is connected to the ARPANET via the COMSAT
  118. Gateway, Clarksburg SIMP and a 4800-bps line to  IMP  71  at
  119. BBN.    The  roundtrip  delay  via  this  path  between  the
  120. COMSAT-GAT  host  and  the  BBN  Gateway  is  typically  550
  121. milliseconds as the ICS datagram flies.
  122.  
  123.      As in the case of all DCNET hosts,  if  the  COMSAT-WWV
  124. virtual  host  is  down  (in  this case possible only if the
  125. Spectracom radio clock is down or misbehaving) a  "host  not
  126. reachable"   GGP   datagram   is   returned.    In   unusual
  127. circumstances a "net not reachable" or "source  quench"  GGP
  128. datagram  could  be  returned.   Note that the references to
  129. "GGP" here will be read "ICMP" at  some  appropriate  future
  130. time.
  131.  
  132. Local Offset Corrections
  133.  
  134.      All DCNET timestamps are  referenced  to  a  designated
  135. virtual  host  called  COMSAT-WWV (what else?) with internet
  136. address [29,0,9,2].  This host is equipped with a Spectracom
  137. radio  clock  which  normally provides WWVB time and date to
  138. within a millisecond.  The clock  synchronization  mechanism
  139. provides  offset  and  drift  corrections  for  other  hosts
  140. relative to this host; however, offsets up to an appreciable
  141. fraction  of  a second routinely occur due to the difficulty
  142. of tracking with power-line  clocks  in  some  machines.   A
  143. table  of  the  current  offsets  can  be obtained using the
  144. following procedure.
  145.  
  146. 1.  Connect  to  COMSAT-GAT   host   at   internet   address
  147.     [29,0,1,2] using TELNET and local echo.
  148.  
  149. 2.  Send the command SET HOST HOST.  A table with  one  line
  150.     per DCNET host should be returned.  Note the entry under
  151.     the "Offset" column for the WWV host.  This contains the
  152.     offset  in  milliseconds  that  should  be  added to all
  153.     timestamps  generated  by  either  the   COMSAT-GAT   or
  154.     COMSAT-WWV  hosts to yield the correct time as broadcast
  155.     by WWVB.
  156.  
  157. 3.  Send the command SET WWV SHOW.  A  summary  of  datagram
  158.     traffic  is  returned  along with an entry labelled "NBS
  159.  
  160. DCNET Internet Clock Service                        PAGE   4
  161.  
  162.  
  163.  
  164.     time." The string  following  this  is  the  last  reply
  165.     received from the Spectracom unit in the format:
  166.  
  167.                   <code>  DDD HH:MM:SS  TZ=00
  168.  
  169.     where <code> is normally <SP> in case the WWVB signal is
  170.     being  received  correctly  or ? in case it is not.  The
  171.     DDD represents the day of the year and HH:MM:SS the time
  172.     past   UT   midnight.   The  two  digits  following  TZ=
  173.     represent the time zone, here 00 for UT.
  174.  
  175. 4.  Close the connection (please!).
  176.  
  177.  
  178. REFERENCES
  179.  
  180. [1]  ICMP
  181.  
  182.    Postel, J., "Internet Control Message Protocol", RFC 777,
  183.    USC/Information Sciences Institute, April 1981.
  184.  
  185. [2]  GGP
  186.  
  187.    Strazisar, V., "How to Build a Gateway", IEN 109, Bolt
  188.    Beranek and Newman, August 1979.
  189.  
  190. DCNET Internet Clock Service                        PAGE   5
  191.  
  192.  
  193.  
  194. Following is a specification of  the  ICS  header  in  PDP11
  195. code:
  196.  
  197. ;
  198. ; GGP/ICMP Header
  199. ;
  200.  .       =       0
  201. GH.TYP:  .BLKB   1               ;Message type
  202. GC.RPY   =       0               ;Echo reply
  203. GC.UPD   =       1               ;Routing update
  204. GC.ACK   =       2               ;Positive acknowledgment
  205. GC.DNR   =       3               ;Destination unreachable
  206. GC.SQN   =       4               ;Source quench
  207. GC.RDR   =       5               ;Redirect
  208. GC.ECH   =       10              ;Echo
  209. GC.STA   =       11              ;Net interface status
  210. GC.NAK   =       12              ;Negative acknowledgment
  211. GC.TIM   =       15              ;Timestamp
  212. GC.TRP   =       16              ;Timestamp Reply
  213. GH.COD:  .BLKB   1               ;Message code
  214. GH.SEQ:  .BLKW   1               ;Sequence number
  215. GH.HDR   =       .               ;Beginning of original
  216.                                  ;internet header
  217. GH.ORG:  .BLKW   2               ;Originating timestamp
  218. GH.REC:  .BLKW   2               ;Received timestamp
  219. GH.XMT:  .BLKW   2               ;Transmitted timestamp
  220. GH.LEN   =       .               ;End of timestamp header
  221.  
  222.      Note that all  PDP11  word  fields  (.BLKW  above)  are
  223. "byte-swapped,"  that  is, the order of byte transmission is
  224. the high-order byte followed by the low-order  byte  of  the
  225. PDP11 word.
  226.