Difference between pages "Package:Ntp" and "Package:Chrony"

(Difference between pages)
m
 
m (Threesixes moved page Set Up Chrony For Accurate System Time to Package:Chrony: 4 the chaos)
 
Line 1: Line 1:
{{Ebuild
+
=== Accurate System Time (NTP) ===
|Summary=Network Time Protocol suite/programs
+
|CatPkg=net-misc/ntp
+
|Homepage=http://www.ntp.org/
+
}}
+
  
=== Installation ===
+
It's important that your Funtoo Linux system has an accurate clock. NTP (network time protocol) can ensure your clock is accurate at all time.
{{console|body=
+
###i## emerge net-misc/ntp
+
}}
+
  
=== Configuration ===
+
The recommended NTP client/server is '''{{Package|net-misc/chrony}}'''.
==== Client ====
+
The ntp-client command immediately synchronizes your clock, and has separate ntp sync settings from the daemon:
+
  
{{file|name=/etc/conf.d/ntp-client|lang=|desc=setting ntp-client upstream servers|body=
+
<console>
NTPCLIENT_OPTS="-s -b -u \
+
###i## emerge chrony
0.pool.ntp.org 1.pool.ntp.org \
+
###i## rc-update add chronyd default
2.pool.ntp.org 3.pool.ntp.org"
+
</console>
}}
+
  
==== Server ====
+
Use something like the following for your <code>/etc/chrony/chrony.conf</code>:
The ntpd server is also an ntp-client of upstream servers.  Ntpd continuously, and gradually synchronizes the local clock.
+
  
{{file|name=/etc/ntp.conf|lang=|desc=setting ntpd upstream servers|body=
+
<pre>
# Pools for Gentoo users
+
server time.apple.com
server 0.pool.ntp.org
+
maxupdateskew 100
server 1.pool.ntp.org
+
driftfile /etc/chrony/chrony.drift
server 2.pool.ntp.org
+
keyfile /etc/chrony/chrony.keys
server 3.pool.ntp.org
+
commandkey 1
}}
+
dumponexit
 +
dumpdir /var/log/chrony
 +
initstepslew 10 time.apple.com
 +
logdir /var/log/chrony
 +
log measurements statistics tracking
 +
logchange 0.5
 +
mailonchange me@emailprovider.com 0.5
 +
rtcfile /etc/chrony/chrony.rtc
 +
rtconutc
 +
sched_priority 1
 +
lock_all
 +
</pre>
  
=== Runtime ===
+
Chronyd can then be started immediately by running <code>rc</code> to start all new services:
{{console|body=
+
 
###i## rc-update add ntpd
+
<console>
###i## rc-update add ntp-client
+
 
###i## rc
 
###i## rc
}}
+
</console>
  
==== Hardware Clock ====
+
Because Funtoo Linux starts network daemons without waiting for an Internet connection to become available, and because chrony will attempt to synchronize the clock over the Internet when it first starts, you must manually configure chronyd to be dependent on whatever method you use to enable your outbound network connectivity. For example, if using <code>dhcpcd</code>, add the following to <code>/etc/conf.d/chronyd</code>:
To write your NTP sync time to the hardware at shutdown, and read hw clock at start.
+
  
{{console|body=
+
<pre>
###i## echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock
+
rc_need=dhcpcd
###i## echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock
+
</pre>
###i## rc-service hwclock restart
+
###i## rc-update add hwclock boot
+
}}
+
  
=== External Resources ===
+
You should notice a marked improvement in your system clock's accuracy. If your system time was off by a significant amount, <code>chronyd</code> will gradually correct your clock while the system runs.
http://keetweej.vanheusden.com/query_ntp.php
+
  
{{EbuildFooter}}
+
[[Category:System]]
 +
[[Category:Official Documentation]]

Revision as of 03:29, January 25, 2015

Accurate System Time (NTP)

It's important that your Funtoo Linux system has an accurate clock. NTP (network time protocol) can ensure your clock is accurate at all time.

The recommended NTP client/server is Package:Chrony.

# emerge chrony
# rc-update add chronyd default

Use something like the following for your /etc/chrony/chrony.conf:

server time.apple.com
maxupdateskew 100
driftfile /etc/chrony/chrony.drift
keyfile /etc/chrony/chrony.keys
commandkey 1
dumponexit
dumpdir /var/log/chrony
initstepslew 10 time.apple.com
logdir /var/log/chrony
log measurements statistics tracking
logchange 0.5
mailonchange me@emailprovider.com 0.5
rtcfile /etc/chrony/chrony.rtc
rtconutc
sched_priority 1
lock_all

Chronyd can then be started immediately by running rc to start all new services:

# rc

Because Funtoo Linux starts network daemons without waiting for an Internet connection to become available, and because chrony will attempt to synchronize the clock over the Internet when it first starts, you must manually configure chronyd to be dependent on whatever method you use to enable your outbound network connectivity. For example, if using dhcpcd, add the following to /etc/conf.d/chronyd:

rc_need=dhcpcd

You should notice a marked improvement in your system clock's accuracy. If your system time was off by a significant amount, chronyd will gradually correct your clock while the system runs.