NTP - Network Time Protocol
E. Frank Ball III
North Bay Linux Users Group
Time Services:
- http header: port 80/tcp (curl -I nblug.org)
- "daytime": port 13/tcp (curl nblug.org:13)
- runs from inetd or xinetd
- text format
- no defined format or timezone
- RFC867
- "time": port 37/tcp (rdate -p nblug.org)
- runs from inetd or xinetd
- RFC868
- "ntp": port 123/udp (ntpq -p nblug.org, ntpdate nblug.org)
- ntp package includes both ntpd and nptdate
- ntpd is the daemon, ntpdate runs one time
- ntpd is both client and server
- RFC5905
NTPD:
- smoothly adjusts time, no jumps
- compares time from several servers and selects the best
- compensates for network delays
- minimum of 3 servers
- more than 7 servers is considered poor etiquette
- starts at 64 second intervals (2^6 seconds)
- stabilizes at 17 minute intervals (2^10 seconds)
- for best performance use servers nearby
NTP stratum:
- stratum 1 is syncronized to an atomic clock
- stratum 2 is syncronized to a stratum 1 clock
- stratum 3 is syncronized to a stratum 2 clock
- don't worry too much about the stratum
- even a stratum 4 clock can be accurate to a few milliseconds
- works best if servers are all same stratum
Atomic Clocks:
- atomic clocks use the microwave signal that electrons emit when they change energy levels
- NIST clock is accurate to 1 second in 20 million years
- WWV radio from Boulder Colorado
- Every GPS satellite has an atomic clock
- GPS clock is accurate to 10ns
pool.ntp.org:
/etc/ntp.conf:
- volunteer pool servers around the world
- server 0.pool.ntp.org iburst
- server 1.pool.ntp.org iburst
- server 2.pool.ntp.org iburst
- server 3.pool.ntp.org iburst
pool.ntp.org:
better config to use just USA servers:
- server 0.us.pool.ntp.org iburst
- server 1.us.pool.ntp.org iburst
- server 2.us.pool.ntp.org iburst
- server 3.us.pool.ntp.org iburst
default debian ntp.conf:
- server 0.debian.pool.ntp.org iburst
- server 1.debian.pool.ntp.org iburst
- server 2.debian.pool.ntp.org iburst
- server 3.debian.pool.ntp.org iburst
- restrict -4 default kod notrap nomodify nopeer limited noquery
- restrict -6 default kod notrap nomodify nopeer limited noquery
Active Pool Servers:
http://www.pool.ntp.org
- Africa 17
- Asia 240
- Europe 2547
- North America 937
- Oceania 103
- South America 43
- Global 3598
pool servers:
montly data usage:
- USA server at 100MB connection = 100GB/month
- UK server at 100MB connection = 9GB/month
- USA server at 3MB connection = 10GB/month
Statistics: