Wednesday, December 29, 2010

NTP -- Synchronize time using other NTP peers

The easiest way to configure NTP is to use the GUI.
  1. On the top bar, right-click the time and select Preferences
  2. Click Time Settings and the Set System Time
  3. Check the box Synchronize date and time over the network
  4. Edit the list of NTP servers and click OK
Alternatively, you can execute system-config-date to go directly to step 3.

To perform the same via command line:
  1. Edit /etc/ntp.conf
    1. Configure 1 or more server lines like below
      1. server 0.rhel.pool.ntp.org
      2. or server 192.168.10.1
  2. Start the service
    1. service ntpd start
When all finished, make sure ntpd is set to start automatically for next reboot chkconfig ntpd on.
You can also perform a one-off sync by running ntpdate 192.168.10.1 (this only works if ntpd isnt running)

2 comments:

GDP said...

My impression here is that in ntp.conf, the peer configuration statement should be used instead of server, from the ntp.conf manpage:

peer For type s addresses (only), this command mobilizes a persistent symmetric-active mode association with the specified remote peer. In this mode the local clock can be synchronized to the remote peer or the remote peer can be synchronized to the local clock. This is useful in a network of servers where, depending on various failure scenarios, either the local or remote peer may be the better source of time. This command should NOT be used for type b, m or r addresses.

Anonymous said...

Can you use ntp without a server, only peers?