Ntp

NTP (Network Time Protocol) is used to synchronize the system time with other devices over the network, this usually happens in a client-server model.

Installation
Install :

Or alternatively, you can use instead.

Ntp-Client
to adjust ntp-client's command & upstream servers.

Server
Here you can specify with which servers you want to synchronize your local time for ntpd.

The default configuration is populated with

Per default the gentoo servers are listed and enabled. A list of available servers can be found here: ntp.org You can also define a home or company server here, given that ntpd is running and the machine is allowed to.

Permissions
To control who is allowed to synchronize with this machine and change the configuration, you can change these options.


 * access to NTP service allowed only from localhost.


 * access to NTP service allowed only from the 192.168.0.0/24 network.

Usage
Basic tools and common usage

Ntp-Client
To monitor status of the client.

To start at boot.

Ntpdate
This used to be the client, but its functionality is now moved into ntpd & ntp-client itself. It is purely to set the local time when started and then exits (not a service):

Ntpd Service
If ntpd is run as a service, the time will automatically synchronize as long as the difference between the local time and the time on the server is less than 1000s (~17min). So it is pretty common to adjust the time initially to whatever the server time is as a trusted source:

Add ntpd to the default runlevel to have the time synchronized automatically. There is no need to run a client when the service is running. Make sure you are not running ntp-client or ntpdate.

To monitor status of the server.

Hardware Clock
To write your NTP sync time to the hardware at shutdown, and read hw clock at start.

Or on a sufficiently modern kernel (3.9 or newer), you can configure Linux to handle it automatically:

The hwclock init script is not needed at all with this method, which speeds up the boot/shutdown process slightly.

External resources

 * ntp.org