NTP Network Time Goals of this lab: Learn how to maintain synchronized clocks in a network. Prerequisites: LXB, NET REVISION: 2.0 [2015-08-28] ©2005-2015 DAVID BYERS Table of Contents PREPARATION ......................................................................................................................................................... 1 Exercise 1: Review and preparation ............................................................................................................ 1 MAIN LAB ................................................................................................................................................................ 3 Part 1: Network time .......................................................................................................................................... 3 Exercise 2: The Network Time Protocol ...................................................................................................... 4 Exercise 3: Install and configure NTP server and clients ............................................................................. 4 IDA/ADIT NTP: NETWORK TIME IDA/ADIT NTP: NETWORK TIME PREPARATION Complete these exercises before starting with the main lab. The package documentation and on-line sources should be sufficient to answer the questions. Exercise 1: Review and preparation Documentation for nt p is available in /usr/share/doc/ntp-doc on marsix. 1-1 Make sure you understand roughly how ntp works. 1-2 Make sure you know what an ntp peer is. 1-3 Read the documentation for nt pdat e, nt pd, nt pq and ntp.conf. 1-4 What command would you use to display the current status of ntp on a host? Report: No report is required. IDA/ADIT NTP: NETWORK TIME 1 MAIN LAB Keeping clocks in a network tightly synchronized is surprisingly important. Although most applications will function even if clocks are not synchronized, you can run in to unexpected problems such as: • It becomes impossible to correlate events in log files on different computers. • It becomes impossible to determine the true time of events in the system (such as crashes, breakins or other nasty problems). • Tools that use the modification time on files may come to different conclusions on different clients that use the same shared filesystem (for example, mak e might think files are modified in the future, or that files that have been modified actually haven’t). • Single sign-on systems such as Kerberos will not function properly if clocks diverge too much. • Users get confused and start complaining. Keeping clocks synchronized is easy, and should always be done, even if there is no apparent need. Time taken 2006: 1.5-7 hours, average 3.5 hours. Past problems: For most groups this lab was pretty straightforward. One problem is that NTP takes quite a long time to synchronize, which means that test cases take a long time to run. For this reason, it’s important to be careful with configuration, so it works right the first time – multiple rounds of testing will consume a lot of time. It might also be a good idea to work on this lab and on some other lab in parallel. If you find that this lab is taking you more than six hours, please make sure you talk to the lab assistant to get some help. Part 1: Network time There are several tools that will enable a system administrator to keep clocks in a network synchronized. Fundamentally, they all are based on the concept of a shared reference clock, a clock that every system turns to for the correct time, but how the reference clock is used differs widely. The simplest method is to set the system clock at boot time and then let it run freely. This method is only adequate when fairly large errors are acceptable and when systems are restarted frequently. A slightly more sophisticated method is to have the computer set its clock periodically from a reference clock. This avoids high levels of clock skew, but has the distinct disadvantage of introducing discontinuous time. Every time the clock is set, time jumps, and some software can react very badly to jumps in time. The network time protocol (NTP), which is used in this lab, operates at a completely different level. It establishes relationships with one or more reference clocks and maintains synchronization with them by speeding up or slowing down the system clock, thereby avoiding discontinuities. A typical NTP system will set its clock at startup using one of its NTP servers as a reference, and then use NTP to keep it synchronized. Setting the clock at startup is necessary, since NTP will refuse to adjust the system clock if the difference between it and the reference clock is too large. IDA/ADIT NTP: NETWORK TIME 3 Exercise 2: The Network Time Protocol 2-1 Explain the concept of “stratum” in a clock hierarchy (e.g. NTP, but also synchronized networks and other clock hierarchies).Why is it necessary to have a hierarchy of clocks rather than just a bunch of reference clocks? 2-2 How large a difference between the reference clock and the system clock does NTP accept and attempt to adjust? 2-3 NTP usually works by speeding up or slowing down the clock, not setting it outright. Why? Report: Answers to the questions above. The time service is the one service that makes sense to run on the router, the reason being that many commercial routers include an NTP server. Exercise 3: Install and configure NTP server and clients The NTP server should be installed on your router. Placing the NTP server on your router is reasonable as many NTP servers today include NTP servers. 3-1 Install the necessary software and configure your router as an NTP server. It should use idagw.sysinst.ida.liu.se as its reference clock. It should allow no other peers to update its clock. Anyone should be allowed to read the clock. 3-2 Configure your clients and your server as NTP clients of your router. They should either get the time directly from the router or accept broadcast or multicast time announcements from the router. 3-3 Explain the output of nt pq –p. 3-4 Verify that NTP works. Report: Automated test cases that show that NTP works as expected. An explanation of the entire output of nt pq –p. Note that NTP can take quite some time before it starts adjusting the clock. When testing, be patient and allow NTP several minutes to do anything. You can run the ntp server with debugging enabled in the router console to see more information about what it is doing. IDA/ADIT NTP: NETWORK TIME 4 FEEDBACK FORM NTP Complete this feedback form individually at the end of the lab and hand it to the lab assistant when you finish. Your feedback is essential for improving the labs. Each student should hand in a feedback form. Do not cooperate on completing the form. You do not need to put your name on the feedback form. Your feedback will be evaluated the same way regardless of whether your name is on it or not. Your name is valuable to us in case you have made and comments in the last section that need clarifications or otherwise warrant a follow-up. For each section, please rate the following (range 1 to 5 in all cases). Difficulty: Rate the degree of difficulty (1=too easy, 5=too difficult) Learning: Rate your learning experience (1=learned nothing, 5=learned a lot). Interest: Rate your interest level after completing the part (1=no interest, 5=high interest). Time: How long did the part take to complete (in minutes)? Difficulty Learning Interest Time (minutes) Preparation Part 1: Network time Overall Please answer the following questions: What did you like about this lab? What did you dislike about this lab? Make a suggestion to improve this lab. IDA/ADIT NTP: NETWORK TIME FEEDBACK FORM NTP Complete this feedback form individually at the end of the lab and hand it to the lab assistant when you finish. Your feedback is essential for improving the labs. Each student should hand in a feedback form. Do not cooperate on completing the form. You do not need to put your name on the feedback form. Your feedback will be evaluated the same way regardless of whether your name is on it or not. Your name is valuable to us in case you have made and comments in the last section that need clarifications or otherwise warrant a follow-up. For each section, please rate the following (range 1 to 5 in all cases). Difficulty: Rate the degree of difficulty (1=too easy, 5=too difficult) Learning: Rate your learning experience (1=learned nothing, 5=learned a lot). Interest: Rate your interest level after completing the part (1=no interest, 5=high interest). Time: How long did the part take to complete (in minutes)? Difficulty Learning Interest Time (minutes) Preparation Part 1: Network time Overall Please answer the following questions: What did you like about this lab? What did you dislike about this lab? Make a suggestion to improve this lab. IDA/ADIT NTP: NETWORK TIME