Bookmark this page

Guided Exercise: Adjusting System Time

In this lab, students will adjust the timezone on a system and synchronize the hardware clock with a NTP time source.

Outcomes

Students will configure the serverX system to use the time zone appropriate for Haiti and configure chronyd on serverX to use the NTP server running on classroom.example.com as time source.

  1. Your serverX machine has been relocated to Haiti. Change the time zone on the serverX machine appropriate for Haiti and verify the time zone has been changed properly.

    1. Identify the correct time zone for Haiti on serverX.

      [root@serverX ~]# tzselect
      Please identify a location so that time zone rules can be set correctly.
      Please select a continent or ocean.
       1) Africa
       2) Americas
       3) Antarctica
       4) Arctic Ocean
       5) Asia
       6) Atlantic Ocean
       7) Australia
       8) Europe
       9) Indian Ocean
      10) Pacific Ocean
      11) none - I want to specify the time zone using the Posix TZ format.
      #? 2
      Please select a country.
       1) Anguilla                 28) Haiti
       2) Antigua & Barbuda        29) Honduras
       3) Argentina                30) Jamaica
       4) Aruba                    31) Martinique
       5) Bahamas                  32) Mexico
       6) Barbados                 33) Montserrat
      ... output omitted ...
      26) Guatemala                53) Virgin Islands (US)
      27) Guyana
      #? 28
      
      The following information has been given:
      
      	Haiti
      
      Therefore TZ='America/Port-au-Prince' will be used.
      Local time is now:	Thu Nov 20 11:07:46 EST 2014.
      Universal Time is now:	Thu Nov 20 16:07:46 UTC 2014.
      Is the above information OK?
      1) Yes
      2) No
      #? 1
      
      You can make this change permanent for yourself by appending the line
      	TZ='America/Port-au-Prince'; export TZ
      to the file '.profile' in your home directory; then log out and log in again.
      
      Here is that TZ value again, this time on standard output so that you
      can use the /usr/bin/tzselect command in shell scripts:
      America/Port-au-Prince
      
    2. Change the time zone to America/Port-au-Prince on serverX.

      [root@serverX ~]# timedatectl set-timezone America/Port-au-Prince
    3. Verify the time zone has been properly set on serverX.

      [root@serverX ~]# timedatectl
            Local time: Wed 2014-11-20 11:09:00 EST
        Universal time: Wed 2014-11-20 16:09:00 UTC
              RTC time: Wed 2014-11-20 16:09:00
              Timezone: America/Port-au-Prince (EST, -0500)
           NTP enabled: yes
      NTP synchronized: no
       RTC in local TZ: no
            DST active: no
       Last DST change: DST ended at
                        Sun 2014-11-02 01:59:59 EDT
                        Sun 2014-11-02 01:00:00 EST
       Next DST change: DST begins (the clock jumps one hour forward) at
                        Sun 2015-03-08 01:59:59 EST
                        Sun 2015-03-08 03:00:00 EDT
  2. Enable NTP synchronization on the serverX system and use classroom.example.com as time source.

    1. Configure chronyd to synchronize the time on serverX with classroom.example.com. Edit /etc/chrony.conf to resemble the following configuration file excerpt:

      # Use public servers from the pool.ntp.org project.
      # Please consider joining the pool (http://www.pool.ntp.org/join.html).
      # server 0.rhel.pool.ntp.org iburst
      # server 1.rhel.pool.ntp.org iburst
      # server 2.rhel.pool.ntp.org iburst
      # server 3.rhel.pool.ntp.org iburst
      server classroom.example.com iburst
      ...
    2. Restart the chronyd service on serverX.

      [root@serverX ~]# systemctl restart chronyd
    3. Turn on NTP synchronization on serverX if it is not already turned on.

      [root@serverX ~]# timedatectl set-ntp true
  3. Verify the serverX system has its clock synchronized with classroom.example.com by using NTP.

    1. Verify the hardware clock on serverX was synchronized with NTP.

      [root@serverX ~]# timedatectl
      ...
      NTP synchronized: yes
      ...
      
    2. Verify that the classroom.example.com system is used as time source for synchronizing the clock on serverX.

      [root@serverX ~]# chronyc sources -v
      210 Number of sources = 1
      
        .-- Source mode  '^' = server, '=' = peer, '#' = local clock.
       / .- Source state '*' = current synced, '+' = combined , '-' = not combined,
      | /   '?' = unreachable, 'x' = time may be in error, '~' = time too variable.
      ||                                                 .- xxxx [ yyyy ] +/- zzzz
      ||                                                /   xxxx = adjusted offset,
      ||         Log2(Polling interval) -.             |    yyyy = measured offset,
      ||                                  \            |    zzzz = estimated error.
      ||                                   |           |                         
      MS Name/IP address         Stratum Poll Reach LastRx Last sample
      ===============================================================================
      ^* classroom.example.com         8   6    37    51   -25ns[-703us] +/-  128us
Revision: rh199-7-d0984a3