-: NTP, the Network Time Protocol. 2 2
In this lesson, we're going to talk all about NTP, 3 3
the Network Time Protocol. 4 4
NTP is a networking protocol 5 5
that's used for the synchronization of clocks 6 6
between different computer systems 7 7
that communicate over a packet-switched, 8 8
variable-latency data network. 9 9
Now TCP/IP networks are packet-switched, 10 10
variable-latency data networks, 11 11
so NTP is going to be used to synchronize the time 12 12
across all of our IP-connected servers. 13 13
Now NTP is pretty special 14 14
because it's a really old protocol. 15 15
In fact, it's one of the oldest internet protocols 16 16
that we still use today. 17 17
NTP data is going to be sent over UDP using port 123. 18 18
The most current version of NTP is NTP version 4, 19 19
and that was released back in 2010. 20 20
Now NTP is really important in our computer networks 21 21
because it ensures we're all using the same time. 22 22
In fact, NTP is designed to synchronize the clocks 23 23
of all participating computers 24 24
to within a few milliseconds of the UTC 25 25
or the Coordinated Universal Time. 26 26
Now you can have an internal NTP server within your network, 27 27
which is usually going to be more accurate 28 28
up to within a few milliseconds, 29 29
or you can use an external NTP server 30 30
that is publicly available on the internet, 31 31
but the accuracy of this 32 32
is only within tens of milliseconds. 33 33
Now why is it important to care so much about time? 34 34
Well, the reason that using NTP is so important 35 35
and making sure time is accurate 36 36
is that a lot of our security protocols 37 37
rely on reliable time for things to work properly. 38 38
For example, 39 39
if the time between your workstation and your server 40 40
are off by more than about five minutes, 41 41
you could get an error 42 42
that prevents you from logging in to the domain. 43 43
So how do we make sure NTP works? 44 44
Well, to learn how it works, 45 45
we need to talk about three components: 46 46
the stratum, the clients, and the servers. 47 47
Well, NTP is designed to use a hierarchal, 48 48
semi-layered system of time sources. 49 49
Each layer of this hierarchy is known as a stratum. 50 50
As with most things in computers, 51 51
we begin counting our stratum with zero, 52 52
and then we start counting up one each time 53 53
as we go further down the hierarchy. 54 54
So if we start with Stratum 0, 55 55
this is the most precise timekeeping devices 56 56
that we have access to. 57 57
This includes things like the atomic clock, GPS, 58 58
and other very accurate devices 59 59
that generate a pulse per second as a trigger 60 60
to create an interrupt and create a timestamp 61 61
on a connected computer. 62 62
If you're directly connected to a time source like this, 63 63
you are in Stratum 0. 64 64
These Stratum 0 clocks are known as reference clocks. 65 65
It's important to note that the NTP server itself 66 66
cannot be considered at Stratum 0. 67 67
Only these reference clocks can. 68 68
So the first NTP servers we have in our hierarchy 69 69
will actually occur at Stratum 1, 70 70
which is any computer whose time source 71 71
is synchronized to within a few microseconds 72 72
of an attached Stratum 0 device. 73 73
To verify their time, these Stratum 1 servers 74 74
can also pair with other Stratum 1 servers. 75 75
And that way, they can verify their time 76 76
is accurate as well. 77 77
These Stratum 1 servers are known as primary time servers. 78 78
Next, we have NTP servers at Stratum 2. 79 79
A Stratum 2 server is connected 80 80
to a synchronized Stratum 1 server. 81 81
Often, a Stratum 2 server 82 82
is configured to query multiple Stratum 1 servers 83 83
to ensure it has a stable and robust time source 84 84
to provide the other devices within its peer group. 85 85
The next level we go to is Stratum 3. 86 86
These Stratum 3 servers 87 87
are synchronized upward to Stratum 2 servers. 88 88
This pattern continues 89 89
with Stratum 4 synchronizing the Stratum 3, 90 90
Stratum 5 synchronizing the Stratum 4, and so on. 91 91
Each time, we add a little bit more delay 92 92
and things become a little bit further from Stratum 0 93 93
with that precise time that we started with. 94 94
Now there is a limit to how many layers 95 95
or stratum we can have in NTP, and the limit is 15. 96 96
If something is classified as a Stratum 16 device, 97 97
this indicates that the device is unsynchronized 98 98
according to the algorithm and the protocol. 99 99
So what does this look like in your enterprise networks? 100 100
Well, usually, you're going to connect the time server 101 101
to your network, or you're going to run a time service 102 102
on something like your domain controller 103 103
with a dedicated hardware reference clock. 104 104
This will be at one of those stratum levels 105 105
we already discussed, depending on how far away 106 106
from the time source you are at Stratum 0. 107 107
Then you're going to install 108 108
a piece of client software on each workstation 109 109
to interface with your server and get the time. 110 110
If you're using Windows, 111 111
it already has this functionality built in 112 112
to its workstations, 113 113
and your domain controllers can run the NTP service 114 114
to act as their time source at one of the stratum levels. 115 115
So you can make sure everybody has the same time 116 116
within your network, 117 117
and they don't have problems logging on to your domain. 118 118
(futuristic music)