Linux Labs

Inside the system: resources, kernel, processes / Stage 11 of 12

Time, time zone and synchronisation

Not running Starting usually ~20 s
Leave the lesson

Step 6 of 7 · lab · 25 minmedium

The clocks of two machines drift apart

The reports from the node1 server are two hours ahead, and the events in the logs of node1 and node2 do not line up. The office time comes from node2. Make the node1 clock follow node2 — now and after the time service restarts.

Situation

node1 is the office reports server. Since yesterday the time in its reports has been two hours ahead, and the events of the same request in the logs of node1 and node2 do not line up in time.

The office time comes from node2: it runs the chrony time server, and the clocks of the other machines should follow it. node1 runs chrony too. The office time zone is Europe/Moscow, and both machines use it.

node1 is your terminal. Run commands on node2 over SSH: ssh node2 'command', or open a shell there — ssh node2, and exit to come back. sudo works without a password on both machines.

Task

  1. chrony on node1 takes its time from node2: in chronyc sources node2 is the selected source (^*), and chronyc tracking shows Leap status : Normal.
  2. The clock of node1 differs from node2 by less than 1 second — right now.
  3. The setting lives in the chrony files, and the service starts at boot: after sudo systemctl restart chrony node1 takes its time from node2 again.

Constraints

  • Do not change node2: its clock and settings are the office time reference.
  • The time zone of both machines stays Europe/Moscow.
  • chrony keeps the time on node1: do not turn it off or replace it with another program.

There is no internet in the lab — only the network between node1 and node2; everything you need is installed. One line compares the clocks of the two machines: date; ssh node2 date. What chrony itself thinks about the time — chronyc sources and chronyc tracking.

Lab · on your own

No commands are given in this lab: type them in the terminal yourself. Goals are checked on the machine after every command.

Goals

0 of 3
  • chrony on node1 takes its time from node2 — node2 is the selected source (^* in chronyc sources), Leap status Normal — not done yet
  • The clock of node1 differs from node2 by less than 1 s; the time zone and the clock of node2 are unchanged — not done yet
  • The setting lives in the chrony files and chrony is enabled; after sudo systemctl restart chrony node1 takes its time from node2 again — not done yet
Ctrl+Enter
Starts the machine node1 · Ubuntu 24.04

The machine is starting

Hints

0 of 3

Lab goals

0 of 3
  • chrony on node1 takes its time from node2 — node2 is the selected source (^* in chronyc sources), Leap status Normal — not done yet
  • The clock of node1 differs from node2 by less than 1 s; the time zone and the clock of node2 are unchanged — not done yet
  • The setting lives in the chrony files and chrony is enabled; after sudo systemctl restart chrony node1 takes its time from node2 again — not done yet
node1 Ubuntu 24.04

Lab goals

0 of 3
  • chrony on node1 takes its time from node2 — node2 is the selected source (^* in chronyc sources), Leap status Normal — not done yet
  • The clock of node1 differs from node2 by less than 1 s; the time zone and the clock of node2 are unchanged — not done yet
  • The setting lives in the chrony files and chrony is enabled; after sudo systemctl restart chrony node1 takes its time from node2 again — not done yet
Loading…