Basics
------
- user space daemon
is "ntpd" running on udp port 123
- ntpd updates the
system clock
- system clock is a
software clock running in the kernel w/c is more accurate
compared to RTC
- RTC is the hardware
clock whose value varies depending on the temperature
(real time clock)
What is Drift File?
-------------------
- stores the
frequency offset between the system clock running at its nominal
frequency and the frequency required to
remain in synchronization with UTC
- used to adjust
system clock every time ntpd start
- located in:
/var/lib/ntp/drift (directory must be writable by NTPD)
- entry on config
file: driftfile /var/lib/ntp/drift
Time on Virtual Machines
------------------------
- they have no
hardware clock w/c is a more accurate time source
- load of hosts (ESX)
where they resides affects the timekeeping (e.g higher
load slows down clock ticks)
NTP Strata
----------
stratum 0
|
atomic clocks, GPS,
mobile phone systems
|
stratum 1
|
computer with radio
clock, GPSclock, or atomic clock attached
|
stratum 2
|
Reads from stratum
1; Serves to lower strata
|
stratum 3
|
Reads from stratum
2; Serves to lower strata
|
stratum n+1
|
Reads from stratum
n; Serves to lower strata
|
stratum 15
|
Reads from stratum
14; This is the lowest stratum
|
stratum 16
|
unsynchronized
state
|
How ntpd chooses a time source?
-------------------------------
1. it will check
which is the closest (e.g least delay, offset, jitter)
2. it will check the
stratum
3. it will check
"prefer" directive in /etc/ntp.conf
NTP configuration file: /etc/ntp.conf
-------------------------------------
assigning a time
source
|
## basic
server
## assigning from
an ntp pool
server
0.rhel.pool.ntp.org iburst
|
restricting access
|
## don't allow IPs
on these list to modify your config file and query
## your NTP server
restrict
192.168.1.0 mask 255.255.255.255 nomodify noquery
## makes sure
localhost has full permissions w/o any restricting keyword
restrict 127.0.0.1
|
misc
|
## fails back to
local clock if no time source is available
server 127.127.1.0
fudge 127.127.1.0
stratum 10
|
Some facts about leap seconds
-----------------------------
- affected systems
are only those who use NTP
- by default, systems
not running NTP are not affected
- leap second might
make the system (or the application running inside) crash
- when a leap second
is inserted, kernel prints it to /var/log/messages
- Cron jobs scheduled
on 00:00 UTC won't be launched twice during leap second
Action Plans to do for Leap Second (from Redhat
support)
--------------------------------------------------------
1) You can stop ntpd
before June 30th, and then start it again when it is more
convenient. Once it is started, it will sync
with the NTP servers.
2) Use ntpd in slew
mode (-x option). With this configuration the time won't be
stepped, instead it will be gradually
adjusted.
Commands
--------
Displaying
|
## checks time
servers (detailed status)
ntpq -p
COLUMNS:
remote
and refid = remote NT P server, and its NT P server
st
= stratum of server
t
= type of server (local, unicast, multicast, or broadcast)
poll
= how frequently to query server (in seconds)
when
= how long since last poll (in seconds)
reach
= octal bitmask of success or failure of last 8 queries
(left-shifted); 377 = 11111111 = all
recent queries were
successful; 257 = 10101111 = 4 most
recent were successful,
5 and 7 failed
delay
= network round trip time (in milliseconds)
offset
= difference between local clock and remote clock
(in milliseconds)
jitter
= difference of successive time values from server (high
jitter could be due to an
unstable clock
NOTE:
- unreliable time
source are those with high delays, offset, and jitters
- its current time
source is the one with *
## checks for brief
ntp status
ntpstat
## syncs with ntp
server manually
ntpdate –u
## queries only;
doesn't set the clock
ntpdate -q
|
No comments:
Post a Comment