Network Time Protocol (NTP) - Computerphile

  Рет қаралды 178,060

Computerphile

Computerphile

Жыл бұрын

Just how do computers synchronise clocks across the Internet? Dr Julian Onions implemented this at Nottingham after meeting the godfather of Internet time, Dave Mills!
/ computerphile
/ computer_phile
This video was filmed and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com

Пікірлер: 275
@kasamialt
@kasamialt Жыл бұрын
A Computerphile video on NTP? It's about time.
@chrisjlocke
@chrisjlocke Жыл бұрын
I second this comment. Or hour it. Its the minute detail. I'll get my coat.
@cscscscss
@cscscscss Жыл бұрын
r/angryupvote
@dannygjk
@dannygjk Жыл бұрын
*Chomping on cigar* It's about time.
@fk319fk
@fk319fk Жыл бұрын
yes it was
@solt87
@solt87 6 күн бұрын
Hour you sure? Well, on second thought...
@TomWhi
@TomWhi Жыл бұрын
More protocols with people who were there to see them written please! I love the anecdotes
@lmamakos
@lmamakos Жыл бұрын
The reason why you back off the polling interval is to allow the effect of the frequency error between the two NTP peers to accumulate enough phase error that can be detectable. There's also some cool algorithms at work here, where as you get closer to the synchronizing the correct local clock frequency, you '"tighten up" the phased-locked loop that's corrected by measured clock offsets (after going through a filter). The clock offset computation also needs to have half of the measured delay time accounted for (which was missing in the video.) Of course, this assumes that the network latency across the network path is symmetric... which isn't always the case. Along with the NTP peer stratum number, another metric, "dispersion" is measured between NTP peers which is roughly how noisy the measurement is. An NTP peer will include the "root dispersion" which is the sum of the dispersions of that peer to the root of that synchronization hierarchy and a measurement of the quality. NTP is great fun. Along with Mike Petry, he and I built the first UNIX NTP implementation of the protocol, doing so only from the draft protocol document and peeking at the PDP-11 assembly code that Dave's implementation was built in. Mike and I were students of Dave's at the University of Maryland and enjoyed many time synchronization experiences ourselves. I built the NTPv1 UNIX implementation on a NeXT workstation in my office. One of the things the NTP program does is compute the intrinsic frequency error of the clock in your computer. It saves this in a file, so that in the event you lose connectivity to your synchronization peer, you can continue to apply the frequency correction, so at least your clock advances at a more correct rate than it would otherwise. From this, I could indirectly measure the temperature of the room as the cheap crystal on the computer's board had a relatively poor temperature coefficient, and it became clear that that the air conditioning in the office got turned off over the weekends and the ambient temperature would rise. And then there were the exciting New Year's Eve experiences! Will the code that handles leap-second insertion work correctly? A leap second is most frequently inserted at 23:59:59 UTC on 31 December, so about 7pm local time. I would disappear into my home office and watch NTP to see if the right thing would happen.. And then struggle to explain to family and friends why this had to happen right now.. Nice video! How novel to see NTP make an appearance on KZfaq!
@smwnl9072
@smwnl9072 Жыл бұрын
Thank you for sharing your expertise and spreading your passion 💪
@tonymurphy30
@tonymurphy30 Жыл бұрын
As a network engineer I use NTP every day, but never actually knew how it worked. - Thanks for the explanation
@BattousaiHBr
@BattousaiHBr Жыл бұрын
same! UDP port 123
@ZX48K
@ZX48K Жыл бұрын
@@BattousaiHBr It's also the number for the speaking clock in the UK. I wonder if that is just a coincidence?
@harrytsang1501
@harrytsang1501 Жыл бұрын
It's one of the things so robust it almost never breaks and you never need to deal with it. However, I think the protocol will fall apart when passed through RFC1149
@ujin981
@ujin981 Жыл бұрын
i'd bet you still don't know
@OlliWilkman
@OlliWilkman Жыл бұрын
Beyond NTP, for high precision time for science experiments and such (e.g. the LHC, or radio telescopes doing VLBI), there's White Rabbit developed at CERN. It can synchronize clocks to under a nanosecond over local distances (tens of km). I used to work in a place that had a dedicated optical fibre running 50 km from the national lab with atomic clocks to sync some radio telescope clocks.
@DantalionNl
@DantalionNl Жыл бұрын
We have started using White rabbit at ASTRON for our LOFAR radio telescope and the preliminary results are really good.
@edmondhung6097
@edmondhung6097 Жыл бұрын
How about those joint radio telescopes that have multiple station and global footprint? How do you sync them? Just reference to GPS clock? Sorry I don’t know the correct terms for this.
@mpdavis731
@mpdavis731 Жыл бұрын
I work in high frequency FX, and NTP was a bit problematic, but so far, chrony suffices with no issue. We only need mics, so nowhere near as sensitive as astronomy use cases.
@siymann
@siymann Жыл бұрын
Why not PTP?
@DantalionNl
@DantalionNl Жыл бұрын
@@edmondhung6097 GPS reference for long term stability in LOFAR and rubidium clocks for short term. In WSRT / APERTIF its hydrogen maser (atomic clocks) for short term stability and still GPS. You have to have some global reference so almost always GPS but want that to be more stable so you combine them
@darrennew8211
@darrennew8211 Жыл бұрын
I studied under Dr Mills. People would occasionally look at a file system / database protocol and say "But what if the client isn't sync'ed to the server?" He'd say "We solved that problem. Let's move on."
@sholinwright2229
@sholinwright2229 Жыл бұрын
Bought his book. We implemented NTP client on a PLC.
@CuthbertNibbles
@CuthbertNibbles Жыл бұрын
Admin: Time Synchronisation is a problem! Chadmin: *Develops protocol to solve problem*
@juliankandlhofer7553
@juliankandlhofer7553 Жыл бұрын
Brilliant! One of the things I love about computer science is that a lot of the people who worked on all these methods and algorithms are still around. Getting information straight from the source is always amazing, especially when its produced and presented as well as you do!
@chrisjlocke
@chrisjlocke Жыл бұрын
I agree - about time this happened. I'll get my coat.
@picoplanetdev
@picoplanetdev 5 ай бұрын
Rest in peace David L. Mills. We stand on the shoulders of giants.
@vholes2803
@vholes2803 Жыл бұрын
A few years ago I moved from pure networking to networking/system administration in a very small company. Server care and maintenance hadn't happened for a while when I arrived and everything was a bit tottery and unstable. I wasn't quite sure what the best approach was but got NTP working across all servers, whether they talked to the outside world or not. This was the crucial first step to stabilising servers and their (inter-server) services. Thanks NTP, you are a winner!
@javabeanz8549
@javabeanz8549 Жыл бұрын
I worked for ISPs, so I had to make sure that servers were synced, as we had to track down issues at times, be it an attack, or just odd network packets, or the occasional P2P notice of copyrighted material being shared. The time stamps on all the devices needed to match.
@RolandLeurs
@RolandLeurs Жыл бұрын
It's really great that at 0:32 and 6:55 you can see a drawing of an 8 bit BBC Micro computer from the 80's. I have build a WiFi board for this computer and a friend of mine, Timo, wrote a program that fetches the time from a NTP server 🙂 Thanks for this explanation Mr Onions.
@jeffdege4786
@jeffdege4786 Жыл бұрын
Back in the early 90s, I'd just started getting into Linux. I was running an Yggdrasil distribution on a 80486 (kernel versión 0.99PL14R). And I started hanging out with a local user's group - Unix Users of Minnesota. NTP clients had just started showing up for Linux, and all us geeks were busy getting things configured. So I'm waiting for the meeting to start, chatting with folks, and the moderator gets up behind the podium to kick things off. And then it turned 7:00 o'clock, and everybody's watch beeped. This was, of course, back in the day when people still thought digital watches were a pretty neat idea. There must have been thirty of us, perhaps twenty had watches with hour-beeps turned on, and we all of us beeped at exactly the same time. We'd all synced to our computers, and our computers were all synced to Internet time.
@BattousaiHBr
@BattousaiHBr Жыл бұрын
wdym "peple still thought digital watches were a neat idea"? they _are_ a neat idea!
@jeffdege4786
@jeffdege4786 Жыл бұрын
@@BattousaiHBr "Far out in the uncharted backwaters of the unfashionable end of the western spiral arm of the Galaxy lies a small unregarded yellow sun. Orbiting this at a distance of roughly ninety-two million miles is an utterly insignificant little blue green planet whose ape-descended life forms are so amazingly primitive that they still think digital watches are a pretty neat idea." - Douglas Adams, "The Hitchhikers' Guide to the Universe"
@robspiess
@robspiess Жыл бұрын
@@jeffdege4786 Don't worry, I got the reference and had a sensible chuckle.
@DavidRexGlenn
@DavidRexGlenn Жыл бұрын
I remember people arguing about whose watch had the correct time. The only way to truly settle the argument was to fire up the shortwave radio and tune it to WWV in Fort Collins. Thanks to NTP and smartphones those tedious arguments are a thing of the past
@anguswett
@anguswett Жыл бұрын
As someone born in the digital age this is fascinating to me
@UnexpectedBooks
@UnexpectedBooks Жыл бұрын
We would tune into that radio on New Year’s Eve during the countdown. We wanted to know *exactly* when the new year started.
@isyt1
@isyt1 Жыл бұрын
In Britain we had a special phone number you could call in the 80s & 90s. The phone number was 123 and it was called, I think, the speaking clock. It was before speech synthesis so used lots of recording of a bloke with a posh English accent. I can still remember the voice “At the third stroke, the time, sponsored by Accurist, will be… eight twenty four pm beep beep beep”
@tetbundy5683
@tetbundy5683 Жыл бұрын
I've only found out a while ago that at least on Android NTP isn't used at all but only cellular network. You can download apps that provide you with NTP and check how far off you are ;)
@isyt1
@isyt1 Жыл бұрын
@@tetbundy5683 I think most phones use “network time”. i.e. they get their time from the mobile phone network. You notice it when you travel abroad and it connects to a new mobile network and your time gets updated. Happens on iPhones anyway and I suspect it makes sense from a technical point of view
@ClifBratcher
@ClifBratcher Жыл бұрын
The underlying architecture for the global NTP Pool is a really interesting as well. It was one of the first instances of GeoDNS to silently get clients connected to the closest regional servers
@JivanPal
@JivanPal Жыл бұрын
TIL that GeoDNS is actually a thing!
@HOYS
@HOYS Жыл бұрын
I’d love to see a video expanding on this to PTP!
@McTroyd
@McTroyd Жыл бұрын
This is awesome. Can we get one of these for Precision Time Protocol?
@JadedWallace
@JadedWallace Жыл бұрын
A student in my uni class did his dissertation that included a case of using NTP in a method of DDOS attack around 2014 (the "derp trolling" group, if that rings a bell for anyone). At the time it broke records on both total bandwidth used up in an attack and the return they got for every bit they sent (I think it was in the 400 bits per bit sent amounts?)
@GeekIWG
@GeekIWG Жыл бұрын
There's just something wonderful about seeing multiple clocks perfectly synced. I love NTP
@TerjeMathisen
@TerjeMathisen Жыл бұрын
I've been involved with the NTP Hackers team for 25+ years, wonderful to see such a nice explanation of what/why/how it works! A few small details: In ntp infinity equals 128 ms! I.e. if a local clock has a time offset larger than this limit, it will reset (typically by jumping the clock) and start the protocol engine from scratch. I.e. the combination of multiple seconds of offset and skewing to correct this doesn't actually occur, unless you have configured ntpd with non-default settings. The protocol will always assume the round trip delays to be symmetrical, but with the huff-puff algorithm, it can also handle temporary one-way overloading, i.e. when the round trip increases so much that the measured clock offset can be explained by such a one-way delay.
@BlankBrain
@BlankBrain Жыл бұрын
NTP came out in 1985. Prime computers didn't have crystal clocks. It was quite a chore to synchronize the clocks. The clock could only be set at the console. When time was set, it started at the indicated minute; there were no seconds. I wrote a program to query the other computers on the ringnet and set the clock. Some computers had more accurate clocks than others. The program had a list of computers from best to worst. If the best computer was unavailable, it would drop to the next. There was also code to do a sanity check if times were too divergent from each other. The time synchronization was added to the backup script because it was run daily from the console.
@rockets4kids
@rockets4kids Жыл бұрын
NTP had been in development and testing since 1980. Among internet-connected Unix machines adoption was incredibly swift.
@BlankBrain
@BlankBrain Жыл бұрын
@@rockets4kids The time period I'm talking about was from about 1979 to 1987. The only network we had besides the ringnet was telnet.
@saudude2174
@saudude2174 Жыл бұрын
this might be the best science channel on this platform. It is in the top for sure.
@cedarmyers6709
@cedarmyers6709 Жыл бұрын
In years past I really enjoyed looking at the delay-offset scatter plots from ntp's peerstats data. It reveals interesting network details like the asymmetry in DSL links, or big changes in global routing. A "network weather monitor" of sorts. Search for the great write up on a focus on NTP in Slovenia to see some of these scatter plots.
@terencegalati970
@terencegalati970 Жыл бұрын
And when you dig into the ntp configuration files, you can set up 2nd order correction files for your computer and get the drift down to +/- 1 ms. Diurnal drift is mostly removed (effects of daily solar heating). Plotting the drift files shows that the correction coefficients are established in a few days. Now that is something you can set your Swiss watch to. (+6 to - 4 seconds drift per day).
@aegixlinux
@aegixlinux Жыл бұрын
This channel is a real treasure!🐧💝
@CMDRunematti
@CMDRunematti Жыл бұрын
If you're able to ask the guy who spent half his life watching clocks about an interview, it would definitely be worth a watch too
@velaater7252
@velaater7252 Жыл бұрын
that is to say, it wouldn't be a waste of time
@BenKonosky
@BenKonosky Жыл бұрын
I second this. It's very timely information.
@clickrick
@clickrick Жыл бұрын
I clocked what you did there
@EpicWolverine
@EpicWolverine Жыл бұрын
Iirc, in some datacenters where synchronized clocks are critical, they'll have servers with their own little atomic clocks as PCIe cards to maintain high precision and reduce drift.
@jmileshc
@jmileshc Жыл бұрын
Look up Jeff Gerling and others who had a play around with them.
@srinivasprasad837
@srinivasprasad837 Жыл бұрын
One of the best KZfaq channels
@AureliusR
@AureliusR Жыл бұрын
NTP is so awesome. I love that Canada has an official NTP time server. It's run by the NRC and is extremely accurate! Been syncing all my computers with NTP for many many years.
@Mr.Leeroy
@Mr.Leeroy Жыл бұрын
Regional NTP server as opposed to pool makes sense at a local IX (internet exchange)
@CallumAi
@CallumAi Жыл бұрын
The UK National Physical Laboratory (NPL), who operate the national radio time signal, also provide an NTP service. As does the London Internet Exchange (LINX).
@CallumAi
@CallumAi Жыл бұрын
As do many ISPs, universities, and the national university network (Janet). When you do some digging you find there are so many public NTP servers!
@almo9004
@almo9004 Жыл бұрын
Too bad, I think the important part of the synchronization algorithm was left out. How should the client update its clock to be the same as the server's? Aiming for t1 - t0 = 0 is clearly not the answer since propagation delay is never exactly 0. What actually happens in NTP is that it aims to get the "midtimes" equal. i.e. make the difference (t2 + t1)/2 - (t3 + t0)/2 equal to 0. Under the assumption that propagation delays are equal in each direction, this quantity will be 0 for a well-synchronized server-client pair.
@OMGclueless
@OMGclueless Жыл бұрын
What if the propagation delays are different in each direction? Is there any way to account for that? This seems like it could be a real problem especially if you're synchronizing with two different servers with different propagation delays, and could gain/lose 50ms every time you switch servers or something.
@cjordahl
@cjordahl Жыл бұрын
Wonderful, thank you! I used to assume that my computer sent a "what time is it?" question and the server replied. I wondered how they accounted for the transit time (although I was never so curious that I looked it up!). Now that I've seen this video the solution seems obvious.
@Michael75579
@Michael75579 Жыл бұрын
Before NTP there was a timeserver protocol that works much as you describe. A client opened a connection to port 37 on the server and the server sent the time as a 4 byte value. Some machines still implement this as part of inetd, although I don't think there are many clients left.
@MarkHopewell
@MarkHopewell Жыл бұрын
What a coincidence! I was just starting to take a closer interest in NTP last week and hey presto, your presentation has appeared at the same time! Thank you.
@JonathanCorwin
@JonathanCorwin Жыл бұрын
I spent the start of this video trying to brush a hair off my phone screen. It turned out to be a drawing on the whiteboard!
@jakemeyer8188
@jakemeyer8188 Жыл бұрын
NTP! One of my fav's and most used...and also one of the things even super nerds don't generally know about. I have microcontrollers running everywhere that need their time synced to my server, and it's amazing how simple a thing can be so useful....and so often forgotten...
@welcometothemadhouse
@welcometothemadhouse Жыл бұрын
This will be useful for a weather station I am building - it has multiple agents, and these need to be synchronised in time; I am still researching ways to do this - this is a good starting point; thanks for this video. I had not thought of this; I am not a computer scientist but more of a mathematical interest. Thanks again!
@patrickssj6
@patrickssj6 Жыл бұрын
Use a real time clock with a battery.
@kevinshumaker3753
@kevinshumaker3753 Жыл бұрын
I use a USB GPS connected and when running chrony it's VERY accurate and becomes its own Stratum1 time source. This gives me a 'known' standard that I can reliably sync other data to.
@kevinshumaker3753
@kevinshumaker3753 Жыл бұрын
@@patrickssj6 Depending on conditions, a RTC has a lot of drift due to environmental conditions if nothing else.
@BattousaiHBr
@BattousaiHBr Жыл бұрын
@@patrickssj6 it drifts out of sync. that's the point of NTP. for example, on linux you may want to run this once a month to sync the RTC with the network time you currently have. hwclock --systohc --utc
@tissuepaper9962
@tissuepaper9962 Жыл бұрын
@@kevinshumaker3753 a GPS clock would be stratum 2, stratum 1 would be the computer inside the satellite where the stratum 0 clock resides.
@gauravupasani9088
@gauravupasani9088 Жыл бұрын
What a coincidence. I was just Reading about NTP today and now Computerphile releases a video about it. 👍🏻
@rockets4kids
@rockets4kids Жыл бұрын
I'm surprised no mention the NTP protocol dates all the way back to 1980!
@magicknight8412
@magicknight8412 Жыл бұрын
Definitely need to follow up and investigate the predictive/detection possibilities with NTP and the drift patterns.
@j7ndominica051
@j7ndominica051 Жыл бұрын
The NTP client on Windows NT6 has mind of its own. If I need to synchronize a computer without a CMOS battery, it's hard to get it to coax into running on startup, keep working, and not reject the time. And when I need it again, I have forgotten what I needed to do.
@randomgeocacher
@randomgeocacher Жыл бұрын
Same on Windows 10 and many Linux. Too large time difference rejected as error / attack.
@j7ndominica051
@j7ndominica051 Жыл бұрын
The max offset can be adjusted. But there's more to it. The first time request may be discarded because the data was "stale", or the service shuts down without a clear reason. It works on winxp. I distribute time from my network router, and want it to use that.
@TheRealStructurer
@TheRealStructurer Жыл бұрын
Nicely explained. Thanks for sharing 👍🏼
@mtpaley1
@mtpaley1 Жыл бұрын
Way back I worked at a antarctic station and setup a server (debian linux) as a level 1 NTP server using data from a gps receiver. I would not be surprised if it is still running 20 years later.
@petarzhelev1373
@petarzhelev1373 Жыл бұрын
Have been waiting for that topic!
@I_Was_Named_This_Way...
@I_Was_Named_This_Way... Жыл бұрын
2nd
@vicmaxabc
@vicmaxabc Жыл бұрын
@@I_Was_Named_This_Way... 3rd
@Michael-Hammerschmidt
@Michael-Hammerschmidt Жыл бұрын
Please do a video on alpha tensor! Would love to learn more about it and the algorithms it discovered
@tclyue
@tclyue Жыл бұрын
Thanks for sharing Julian 👏🏻
@froop2393
@froop2393 Жыл бұрын
Love this channel...
@MePeterNicholls
@MePeterNicholls Жыл бұрын
At uni we had a 4pm network problem. It was destroying our student radio station. And as manager I was spending half my time getting the uni to deal with it. At 4pm the entire network ground to a halt for an hour. It was eventually found it was caused by the entire network doing a full backup of everything. This was 2009 and the techs were still getting used to the rapid use of everyone being constantly online.
@dannooo548
@dannooo548 Жыл бұрын
Since there is latency in the packets getting to the server, why would you want t1 and t0 to be equal? Wouldn't you want t2-t1 to equal t1-t0? Wouldn't that mean that (assuming the packets have the same latency each way), the clocks are in sync? Otherwise if you targeted t1=t0, then your clock would be ahead since you are assuming the latency is 0?
@bluerizlagirl
@bluerizlagirl Жыл бұрын
No, that's not what's happening. The *only* things you are assuming are (1) that all clocks involved advance at the same *rate* even though there may be offsets between them; and (2) that the time (t3-t2) taken for the response to come back is equal to the time taken (t1-t0) for the request to get there. (This also interferes with attempts to measure the speed of light; either you have to make a return journey which you can time with one clock, and then you only know the average speed of light in both directions there and back, or you have to use two separate clocks, and then yeah, let's just not go there.) (t3-t0)-(t2-t1) is the total packet transit time, irrespective of any offset between the client and server end clocks (since both t3 and t0 were recorded at the same end, and so were t2 and t1); so t0 + ((t3-t0)-(t2-t1))/2 is what your clock would have been showing when the other end recorded t1, and from that you can work out how much you need to move your clock forwards or backwards so it shows the same time as the other clock.
@danieljensen2626
@danieljensen2626 Жыл бұрын
In my experience comparing NTP time to a much more precise GPS time source NTP has usually been good only to within 6-10 ms. That's pretty good for most things, but I'm working with scientific equipment that we need to synchronize to within a few nanoseconds ideally, hence the GPS.
@IMBlakeley
@IMBlakeley Жыл бұрын
PTP2 will get you real close to GPS accuracy
@stargazer7644
@stargazer7644 Жыл бұрын
I routinely get sub millisecond sync with normal ntp. It all depends on what you’re syncing to and how stable the latency is in your network. I can get within nanoseconds syncing to GPS 1PPS.
@barneylaurance1865
@barneylaurance1865 Жыл бұрын
At 4:31 Dr Onions says that "the difference in clocks is t1-t0". But isn't that ignoring the time it takes for the round trip? If we assume the trip time is the same both ways then I'd think the difference in clocks would be t_1-t_0 - ((t_3-t_0) - (t_2-t_1))/2 . Or to simplify (t_1 + t_2 - t_0 - t_3) / 2 .
@wgm-en2gx
@wgm-en2gx Жыл бұрын
LOL, just posted the same thing. Should have read the comments further down.
@megamaser
@megamaser Жыл бұрын
This is actually more basic than I thought. It only works because they assume that each round-trip contains two legs of similar duration, and this is usually true, but not always. With only two nodes, it's impossible to determine if the return trip takes more or less time than the outgoing trip. If one leg takes much longer than the other, you can't actually figure out when the other computer recorded its time. You need to coordinate connections between more nodes to figure out how long each leg takes, which is the only way to really get a guarantee about the time.
@matthewbevan4755
@matthewbevan4755 Жыл бұрын
saw a guy uneasily sitting over the table in the thumbnail...... that told me instantly that this dude is obscenely intelligent and will be able to explain why exactly this gobbeldygoop is necessary for everyday life
@CMD_Line
@CMD_Line Жыл бұрын
I'm sure people will disagree but this is one of the most important protocols in network engineering. Certificates, RADIUS, logs, IPSEC etc.. On and on, you lose alot of important things should this fail in a network and things get out of synch.
@BattousaiHBr
@BattousaiHBr Жыл бұрын
ipsec depends on time?
@CMD_Line
@CMD_Line Жыл бұрын
@@BattousaiHBr Yes in IPSEC a security association is formed. It expires based on packets, data or time expired. In order for the SA to form and be correct, timestamps must be the same or the rekeying will fail. The new key has to be generated before the old one fails, if a new one can't be formed and the old one expires then the VPN will drop. Edit* yes you can zero out the lifetime but most companies don't. Also you can read RFC 3585 to read more about IPSEC. I'm by know means an expert, I've just been on the outage when NTP breaks and it kills many things. If for example a power cut happens and dates go back to default and the NTP is down, all hell will break lose because many things will be time expired. Hopefully that makes sense.
@vladislavkaras491
@vladislavkaras491 3 ай бұрын
Great explanation! Thanks!
@andljoy
@andljoy Жыл бұрын
Like most normal people i look at random conversations on networks via wireshark ( what its normal! ) but i have never looked at NTP, i will have to now.
@soildmoose
@soildmoose Жыл бұрын
I worked in a meteorological office which ran an S0 clock, and honestly, I never expected how much fiddling with synchronization I'd have to do! Everything always ran flawlessly, until suddenly, you'd find that some weather station was somehow now the S1 or 2 source for an entire network, and you'd only notice after some random windows authentication stopped working properly!
@BCTAHbKA
@BCTAHbKA Жыл бұрын
This is the best video ever
@Richardincancale
@Richardincancale Жыл бұрын
I used to design and procure national networks, both fixed and mobile. One of the most fun parts was figuring out the clock source - have your own Césium atomic clock, or Rubidium disciplined by GPS… How many to have, hierarchies of clocks…. I think I did 14 networks in all!
@wktodd
@wktodd Жыл бұрын
Thanks that's more complex than I would have thought 8⁠-⁠)
@MetrologyEngineer
@MetrologyEngineer Жыл бұрын
Awesome! Can you guys also do a video on PTP?
@thefloop
@thefloop Жыл бұрын
Such a deceptively complex issue that's basically a necessity for modern communications. The whole power grid thing blows my mind a bit
@Misteribel
@Misteribel Жыл бұрын
In Windows, you can still specify/override what time servers to use, if you find that NTP isn’t reliable enough using the defaults. Just as in Linux, you have system commands to force time recalibration and other fun things.
@XEinstein
@XEinstein Жыл бұрын
Electronic devices in electrical power grids are synched in time, often using a GPS clock to be able to exactly determine where a fault occurs in the power grid. Since AC electricity changes direction every 20 ms it's necessary to have all devices synched up to ms precision
@johnshaw359
@johnshaw359 Жыл бұрын
That's another question answered, I use Net Time manually every so often, I was thinking about how they compensated for such time/distance variances, it syncs "perfect" with the "RF regulated" clock I have.
@sohailanjum6337
@sohailanjum6337 Жыл бұрын
Nice sir explain. Really amazing. I like it.
@BritishBeachcomber
@BritishBeachcomber Жыл бұрын
During the BBC Teletext broadcast trials the on screen clock was always out by several hours because the Unix system clock was not synchronized to anything.
@nicobardier
@nicobardier Жыл бұрын
As a sysadmin I allways enjoyed NTP, it just works and is so useful For so many applications.
@ChrisBLong
@ChrisBLong Жыл бұрын
A few years ago there was one unloved server where I worked whose time was out by about 6 seconds. It caused all manner of weird problems with my builds until I figured it out. The admins fixed it when I reported it but never explained how it came to be so far out in the first place.
@xerxel69
@xerxel69 Жыл бұрын
I thought I knew about NTP. Clearly I didn’t ! But it was the stratums that I need to know about. Thanks!
@isyt1
@isyt1 Жыл бұрын
What a great passionate guy. Wish I had a lecturer like that in uni
@MichaelKingsfordGray
@MichaelKingsfordGray Жыл бұрын
And he is adult enough to use his real name! What a shock that must be to you.
@isyt1
@isyt1 Жыл бұрын
@@MichaelKingsfordGray Why would that shock me or, indeed, anyone?
@MichaelKingsfordGray
@MichaelKingsfordGray Жыл бұрын
@@isyt1 Because as you cower behind a fake "m ame", it is plain to me that you have never met a real adult. That is why it clearly shocked you. For others, assuming that I can speak on their behalf only confirms the case.
@isyt1
@isyt1 Жыл бұрын
@@MichaelKingsfordGray mate, your name isn’t Kingdford lol. Wtf you on about
@St0ner1995
@St0ner1995 Жыл бұрын
Are you guys going to do a video on PTP (Precision time Protocol)?
@irtazachohan5047
@irtazachohan5047 Жыл бұрын
You know this is going to be brilliant when he pulls out the old dot-matrix paper.
@James_Knott
@James_Knott 5 ай бұрын
So, Dave Mills was a clock watcher! 🙂 How about a video on PTP (Precision Time Protocol)?
@AlanTheBeast100
@AlanTheBeast100 Жыл бұрын
Early adopter of NTP before it was quietly cool. Recently did some "certification" of NTP on a RTL system. Was more challenging that I thought to do right (and did find a minor bug in the RTL NTP system (or rather a deeper RTL issue that manifested through those tests)). IAC, armed with a pretty cheap GPS and its 1 PPS signal one can check the NTP algo to about 1000x the accuracy of NTP. [hate to say it, but if you need better accuracy, get a GPS and use the 1 PPS to know the top-of-second quite accurately (less than 1 µs)].
@Neo_Chen
@Neo_Chen Жыл бұрын
As a nerd for precision time keeping, I like this video. (I have a Raspberry Pi 3B+ dedicated as a GNSS NTP Server with chronyd + gpsd)
@pmiron
@pmiron Жыл бұрын
Shouldn't (t1 - t0) (or (t2-t3)) be equal to half of the travel time? I'm confused about how they can be equal to 0 when the clocks are synchronized.
@gijsstoeldraaijers6395
@gijsstoeldraaijers6395 Жыл бұрын
Synchronized means client and server have the same notion of time despite the travel time.
@kale.online
@kale.online Жыл бұрын
He's so gentle I forget I'm hearing super serious technical chat
@harrytsang1501
@harrytsang1501 Жыл бұрын
I wonder how NTP would cope with asymmetric channel latency such as on RFC1149
@IMBlakeley
@IMBlakeley Жыл бұрын
The last job I had before giving up working for a living spent a fair bit of time working with PTP to synchronise small cells.
@CMBrannstrom
@CMBrannstrom Жыл бұрын
Happy Friday, nerds!
@petrifiedmonk
@petrifiedmonk Жыл бұрын
Was this created after mtc midi time code that is used to sync music on beat via midi across multiple recording equipment? Same issue very similar solution.
@jumadhaheri
@jumadhaheri Жыл бұрын
I’ve made a big NTP wall clock with ESP it’s amazing
@seb_gibbs
@seb_gibbs Жыл бұрын
I've tried looking to buy something like this (about a year ago), and very few of these exist, and are over expensive. I dont understand why there isnt a manufacture mass producing loads of these clocks. If they can make $10 smart plugs that connect to the internet, I dont understand why most walls clocks cant be built with this function.
@FishFind3000
@FishFind3000 Жыл бұрын
@@seb_gibbs supply and demand.
@matthewparker9276
@matthewparker9276 Жыл бұрын
It would make sense for industry or corporate applications to have mass produced NTP clocks installed throughout a building, especially where daylight savings is used. A clock should be able to run on PoE, so it becomes a one plug solution that lets all clocks be adjusted remotely. I would think governments and government institutions like schools would provide a decent customer base, enough to make the product viable at least.
@michaelwilkes0
@michaelwilkes0 Жыл бұрын
wow this is way simpler than i was imagining. how do we account for huge outbound latency and tiny inbound latency? or is that rare enough that we just ignore it?
@TristanBailey
@TristanBailey Жыл бұрын
Could you do a video on clocks changing or timezone and how that affects things. Esp as it’s now automated and no one notices like they used to changing clock an hour by hand.
@andrew130592
@andrew130592 Жыл бұрын
Don't they all use UTC and the timezone adjustment is done locally by the system? At a guess...
@nowster
@nowster Жыл бұрын
They did! "The Problem with Time & Timezones" with Tom Scott.
@Glafuski
@Glafuski Жыл бұрын
@@nowster I miss Tom hosting these videos
@shubinternet
@shubinternet Жыл бұрын
Yes, NTP operates exclusively in UTC. All differences from that are a presentation issue within the OS.
@adenwellsmith6908
@adenwellsmith6908 4 ай бұрын
1. There are systems that monitor the power demand by looking at the change in frequency 2. The same thing happened with Railways in the 19th Century, where synchronising clocks between different cities was introduced 3. Hence time zones. 4. Einstein and relativity was all based around think about how time works, when you have to send signals between different observers.
@logiclust
@logiclust 7 ай бұрын
I wish this explanation got into the conf setups
@markfrellips5633
@markfrellips5633 Жыл бұрын
there's a strange series of articles if not books on the technical wonkiness surrounding tea time across so many industries
@KevinBenecke
@KevinBenecke Жыл бұрын
In America our computers also have to contend with the 2 time changes a year as well. In the spring, they jump forward 1 hour at 2:00am and then back again 1 hour in the fall again at 2:00am.
@Michael75579
@Michael75579 Жыл бұрын
I don't know enough about NTP to know whether it cares about daylight savings time or not, but I suspect it doesn't. Internally, Unix just has a counter that ticks forward by one every second and holds the number of seconds that has elapsed since 00:00 GMT on January 1st 1970. Timestamps on files etc. are just the value of this counter. Only programs which need to produce a human-readable time need to care about timezones, DST and all the other complicated stuff. To do this there's a database which lists when DST finishes and ends etc. for each timezone that can be used to do the conversion from internal timestamp to human-readable and library routines which know how to use the information in the database.
@Yupppi
@Yupppi Жыл бұрын
God damn fascinating, the way to see an earthquake in the clock drift.
@Jono4174
@Jono4174 Жыл бұрын
6:10 defining jitter without using the word “jitter”
@jaydenritchie1992
@jaydenritchie1992 Жыл бұрын
im not sure if this has any relevance to anything but if you have ever disconnected from internet and manually changed the computer date settings to as far back as it will let you (mine was 1980) and create a restore point if the date is set at 1980 it is visible on system restore but once you connect to the internet and resync it is no longer visible on the system restore point list. im not sure if this can be used for security considering it to use the internet the time must be in sync. from memory i backdated and created a restore point i then opened that restore point and dragged and dropped other files into it, and as we know data recovery software is quite good at restoring hdd data , i dont know just one of thing that might be overlooked by a hacker or someone might gain physical access if your trying to hide bitcoin wallets etc
@alagaika8515
@alagaika8515 Жыл бұрын
Wait, why do I want t0 to be as close as possible to t1 - doesn't that ignore the packet travel time? I'd expect that I want to get the difference to be as close as possible to half the roundtrip time (assuming that the packet travel time is roughly the same in both directions - this can be improved once I synchronize to multiple servers).
@OMGclueless
@OMGclueless Жыл бұрын
What happens if there is a systematic bias in the direction of traffic? e.g. what if there is a computer behind a router where everyone watches Netflix and the incoming route has a 100ms queue on average, or if there's a firewall that inspects all outgoing packets, or something? If you're just using the round trip time and dividing by 2 you'll be systematically off in one direction.
@RonLaws
@RonLaws Жыл бұрын
really cool video, I actually implemented NTP as part of my home network, since we're in a house share with lots of computers and a file server (NAS) it's nice to have everything syncronised, so i turned it on as a DHCP option and have the NAS serve as the network time server for local clients and it gets it's time from one of the internet NTP pools.
@LordPhobos6502
@LordPhobos6502 Жыл бұрын
I've got a few arduino projects that use a gps to get the time... does that make them a stratum 1 device? Or is there more to it?
@Avaryes
@Avaryes Жыл бұрын
Okay so you estimate the round trip time, but what time does the client actually set? t_3 minus half the round trip time?
@mateuszmikoajczyk2069
@mateuszmikoajczyk2069 Жыл бұрын
I wonder what badge was he wearing that caused it to be blurred out :) initially I thought that computerphile did it but then I googled the name and lo and behold, the picture is literally blurred on the university website :)
@WilliamDye-willdye
@WilliamDye-willdye Жыл бұрын
Having spent months(!) debugging a pesky clock sync problem on a small IOT product, I've developed a distain for NTP. It's great when it works, but when problems emerge on remote customer devices in the field, default NTP provides very few clues. There's a reason why people are developing alternatives like chrony.
@bluerizlagirl
@bluerizlagirl Жыл бұрын
Yes, and the reason is they don't understand the complexity of the problem they are trying to solve.
@shubinternet
@shubinternet Жыл бұрын
There are some problems that chronyd addresses, but many problems are common and have more to do with admins of client computers not understanding what they're doing, or basic things like not having their timezone configured correctly and then blaming the NTP server for not giving them the correct time. I welcome having multiple compatible implementations of the protocol, but there are things that ntpd can do that chronyd can't. So, it's not a one-for-one trade.
@WilliamDye-willdye
@WilliamDye-willdye Жыл бұрын
@@shubinternet In my case the "local admin" can be a small medical or veterinary clinic that cannot afford to hire a trained sysadmin. My complaint with NTP (and many other subsystems) is is the lack of clear feedback when things go wrong. I don't know if crony is better, but I can vouch that there is an increasing demand for better.
@stargazer7644
@stargazer7644 Жыл бұрын
Ntpq gives you lots of info about the state of ntp. I agree it could be a bit more verbose, but you only need to understand a few commands to troubleshoot ntp problems.
@bbq1423
@bbq1423 Жыл бұрын
Was that half-circle on the whiteboard intentional? Been wiping my screen more times than I care to admit.
@zlcoolboy
@zlcoolboy Жыл бұрын
It's crazy that someone watching NTP traffic could see things happening in the real world, like kettles being started and earthquakes. It makes sense though. anything that impacts the electricity that computers are using could cause fluctuations.
@JD-lx2yf
@JD-lx2yf Жыл бұрын
Now, you should do one on IEEE1588 PTP.
@mpdavis731
@mpdavis731 Жыл бұрын
Could a coding error in ntpd be called a jitter bug?
@DantalionNl
@DantalionNl Жыл бұрын
Next video Precision Time Protocol? NTP its more obscure cool cousing.
@timlyg
@timlyg Жыл бұрын
So are we assuming that there's no delay in data travel? (basically the theoretical light speed with no relay servers/hops being slow)?
@widicamdotnet
@widicamdotnet Жыл бұрын
Nope - NTP is specifically meant to measure those delays, characterize them and cancel them out. That's why they're fiddling with four timestamps in the protocol, and doing multiple requests to multiple sources if possible.
@timlyg
@timlyg Жыл бұрын
@@widicamdotnet oh ok. Thanks. Did i missed them explaining it or they just skipped that part? I am really interested in how those delays are detected and measured.
@stargazer7644
@stargazer7644 Жыл бұрын
@@timlyg he explained a part of it, that’s why it uses multiple timestamps in the packet instead of just one. But there’s a lot more to it than what was mentioned in this video.
@timlyg
@timlyg Жыл бұрын
@@stargazer7644 The multiple timestamps idea just seem to be more of a statistical measure, rather than an accurate one. But I'm new at this so I don't know.
Emulation - Computerphile
22:36
Computerphile
Рет қаралды 200 М.
How Computers Synchronize Their Clocks - NTP and PTP Explained
14:13
Khóa ly biệt
01:00
Đào Nguyễn Ánh - Hữu Hưng
Рет қаралды 20 МЛН
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 16 МЛН
The child was abused by the clown#Short #Officer Rabbit #angel
00:55
兔子警官
Рет қаралды 15 МЛН
Breaking RSA - Computerphile
14:50
Computerphile
Рет қаралды 354 М.
DHCP Explained - Dynamic Host Configuration Protocol
10:10
PowerCert Animated Videos
Рет қаралды 2,8 МЛН
NTP vs. PTP: How Do You Get Accuracy?
19:25
ATIS
Рет қаралды 5 М.
WiFi's Hidden ____ Problem - Computerphile
12:05
Computerphile
Рет қаралды 597 М.
Using GPS with PPS to synchronize clocks over the network
20:16
Linux Tech School
Рет қаралды 10 М.
What's Virtual Memory? - Computerphile
22:40
Computerphile
Рет қаралды 174 М.
How WiFi Works - Computerphile
17:19
Computerphile
Рет қаралды 197 М.
PTP - Precision Time Protocol - IEEE 1588v2
9:43
Barbara Anne
Рет қаралды 11 М.
NTP Explained | Network Time Protocol | Cisco CCNA 200-301
10:14
Automated Mathematical Proofs - Computerphile
18:02
Computerphile
Рет қаралды 89 М.
Khóa ly biệt
01:00
Đào Nguyễn Ánh - Hữu Hưng
Рет қаралды 20 МЛН