Time Synchronisation with NTP

49

4. Time Synchronisation with NTP

NTP is a TCPIP 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. Behind this simple description, there is a lot of complexity - there are tiers of NTP servers, with the tier one NTP servers connected to atomic clocks, and tier two and three servers spreading the load of actually handling requests across the Internet. Also the client software is a lot more complex than you might think - it has to factor out communication delays, and adjust the time in a way that does not upset all the other processes that run on the server. But luckily all that complexity is hidden from you Ubuntu uses ntpdate and ntpd. 4.1. ntpdate Ubuntu comes with ntpdate as standard, and will run it once at boot time to set up your time according to Ubuntus NTP server. ntpdate -s ntp.ubuntu.com 4.2. ntpd The ntp daemon ntpd calculates the drift of your system clock and continuously adjusts it, so there are no large corrections that could lead to inconsistent logs for instance. The cost is a little processing power and memory, but for a modern server this is negligible. 4.3. Installation To install ntpd, from a terminal prompt enter: sudo apt-get install ntp 4.4. Configuration Edit etcntp.conf to addremove server lines. By default these servers are configured: Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board on 2011-02-08 LP: 104525. See http:www.pool.ntp.orgjoin.html for more information. server 0.ubuntu.pool.ntp.org server 1.ubuntu.pool.ntp.org server 2.ubuntu.pool.ntp.org server 3.ubuntu.pool.ntp.org After changing the config file you have to reload the ntpd: 50 sudo etcinit.dntp reload 4.5. View status Use ntpq to see to see more info: sudo ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== +stratum2-2.NTP. 129.70.130.70 2 u 5 64 377 68.461 -44.274 110.334 +ntp2.m-online.n 212.18.1.106 2 u 5 64 377 54.629 -27.318 78.882 145.253.66.170 .DCFa. 1 u 10 64 377 83.607 -30.159 68.343 +stratum2-3.NTP. 129.70.130.70 2 u 5 64 357 68.795 -68.168 104.612 +europium.canoni 193.79.237.14 2 u 63 64 337 81.534 -67.968 92.792 4.6. References • See the Ubuntu Time 16 wiki page for more information. • ntp.org, home of the Network Time Protocol project 17 16 https:help.ubuntu.comcommunityUbuntuTime 17 http:www.ntp.org 51

Chapter 5. DM-Multipath