Pages

May 16, 2011

NTP Vs SNTP

NTP-Network Time Protocol.The Network Time Protocol (NTP) daemon synchronizes the system clock with a remote time server or time source (such as a satellite). 
In simple
NTP is a TCP/IP protocol for synchronising time over a network. Basically a client requests the current time from a server, and uses it to set its own clock.
SNTP-Simple Network Time Protocol
SNTP is less precise to NTP
Why its required ?
NTP and SNTP synchronize the clocks of computers on a network to compensate the latency.
When NTP is needed?
NTP is fault tolerant and highly scalable and is used when a more accurate clock is needed.
While a full featured NTP server or client reaches a very high level of accuracy and avoids abrupt timesteps as much as possible by using different mathematical and statistical methods and smooth clock speed adjustments, SNTP can only be recommended for simple applications, where the requirements for accuracy and reliability are not too demanding.
So which algorithm is used in NTP to make more accurate?
Marzullo's Algorithm
What this algorithm says?

  1. The NTP client asks all of its NTP servers what time it is.
  2. The different servers will give different answers, with different confidence levels because the requests will take different amounts of time to travel from the client to the server and back.
  3. Marzullo's algorithm will find the smallest range of time values consistent with all of the answers provided.
  4. You can be more confident of the accuracy of the answer from this algorithm than of that from any single time servers because the intersection of several sets will likely contain fewer elements than any individual set.
  5. The more servers you query, the more constraints you'll have on the possible answer, and the more accurate your clock will be.

Is it really used in Windows machines?
Check out registry key  HKLM\System\CurrentControlSet\Services\W32Time\Par ameters\Type
How about Linux?
/etc/ntp.conf or  /etc/xntp.conf
Service Handling

service ntpd start
service ntpd stop
service ntpd restart

How can i know which server can i use for NTP?
http://www.pool.ntp.org/en/
Log :
Initial:

[root@smallfry tmp]# date
Thu May12 00:00:00 PDT 2011
Update:

[root@smallfry tmp]# service ntpd stop
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:38 ntpdate[2472]: step time server 192.168.1.100 offset 28993.084943 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:40 ntpdate[2472]: step time server 192.168.1.100 offset 2.467652 sec
[root@smallfry tmp]# ntpdate -u 192.168.1.100
Looking for host 192.168.1.100 and service ntp
host found : bigboy.my-site.com
12 Aug 08:03:42 ntpdate[2472]: step time server 192.168.1.100 offset 0.084943 sec
[root@smallfry tmp]# service ntpd start
Final:

[root@smallfry tmp]# date
Thu May12 08:03:45 PDT 2011

Further Reading
NTP
http://www.brennan.id.au/09-Network_Time_Protocol.html
http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch24_:_The_NTP_Server
SNTP
http://www.networksorcery.com/enp/protocol/sntp.htm
http://www.faqs.org/rfcs/rfc2030.html
Executable
http://translate.google.com/translate?hl=en&sl=ja&u=http://www010.upp.so-net.ne.jp/suede/sntpclock.html&ei=nfrTTc2ODafX0QHLsLX7Cw&sa=X&oi=translate&ct=result&resnum=3&ved=0CCsQ7gEwAg&prev=/search%3Fq%3DSNTP%2Binurl:jp%26hl%3Den%26rlz%3D1C1SKPL_enUS422US423%26biw%3D1920%26bih%3D989%26prmd%3Divns
IEEE1588
http://isdl.snu.ac.kr/Korean/doc/GetPDF.pdf

No comments: