Note

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Package:Ntp"

From Funtoo
Jump to navigation Jump to search
m
m
 
(2 intermediate revisions by one other user not shown)
Line 4: Line 4:
|Homepage=http://www.ntp.org/
|Homepage=http://www.ntp.org/
}}
}}
=== Installation ===
=== Installation ===
To install the NTP client and server, run the following command:
{{console|body=
{{console|body=
###i## emerge net-misc/ntp
###i## emerge net-misc/ntp
}}
}}
=== Configuration ===
=== Configuration ===
==== Client ====
==== Client ====
Line 19: Line 18:
2.pool.ntp.org 3.pool.ntp.org"
2.pool.ntp.org 3.pool.ntp.org"
}}
}}
==== Server ====
==== Server ====
The ntpd server is also an ntp-client of upstream servers.  Ntpd continuously, and gradually synchronizes the local clock.
The ntpd server is also an ntp-client of upstream servers.  Ntpd continuously, and gradually synchronizes the local clock.
Line 30: Line 28:
server 3.pool.ntp.org
server 3.pool.ntp.org
}}
}}
=== Runtime ===
=== Runtime ===
If you are interested only in synchronizing your local clock against servers, then only add {{c|ntp-client}} to your list of services to start at boot:
{{console|body=
{{console|body=
###i## rc-update add ntpd
###i## rc-update add ntp-client
###i## rc-update add ntp-client
}}
After adding the {{c|ntp-client}} service to the {{c|default}} runlevel, the service can be started by executing the {{c|rc}} command as root:
{{console|body=
###i## rc
###i## rc
##g##* ##!g##Setting the clock via the NTP client 'ntpdate' ...  ##bl##[##!bl## ##g##OK##!g## ##bl##]##!bl##
}}
}}
{{note|Executing the above command normally takes several seconds}}


If you are instead interested in running an NTP server, add {{c|ntpd}} to your list of services to execute at boot:
{{console|body=
###i## rc-update add ntpd
}}
{{note|{{c|ntpd}} serves as both a client and a server}}
==== Hardware Clock ====
==== Hardware Clock ====
To write your NTP sync time to the hardware at shutdown, and read hw clock at start.
To write your NTP sync time to the hardware at shutdown, and read hw clock at start.
Line 47: Line 54:
###i## rc-update add hwclock boot
###i## rc-update add hwclock boot
}}
}}
=== External Resources ===
=== External Resources ===
http://keetweej.vanheusden.com/query_ntp.php
http://keetweej.vanheusden.com/query_ntp.php
{{EbuildFooter}}
{{EbuildFooter}}

Latest revision as of 20:29, March 31, 2019

Ntp

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.

Installation

To install the NTP client and server, run the following command:

root # emerge net-misc/ntp

Configuration

Client

The ntp-client command immediately synchronizes your clock, and has separate ntp sync settings from the daemon:

   /etc/conf.d/ntp-client - setting ntp-client upstream servers
NTPCLIENT_OPTS="-s -b -u \
	0.pool.ntp.org 1.pool.ntp.org \
	2.pool.ntp.org 3.pool.ntp.org"

Server

The ntpd server is also an ntp-client of upstream servers. Ntpd continuously, and gradually synchronizes the local clock.

   /etc/ntp.conf - setting ntpd upstream servers
# Pools for Gentoo users
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org

Runtime

If you are interested only in synchronizing your local clock against servers, then only add ntp-client to your list of services to start at boot:

root # rc-update add ntp-client

After adding the ntp-client service to the default runlevel, the service can be started by executing the rc command as root:

root # rc
root ##g##* ##!g##Setting the clock via the NTP client 'ntpdate' ...   [ OK ]
   Note

Executing the above command normally takes several seconds

If you are instead interested in running an NTP server, add ntpd to your list of services to execute at boot:

root # rc-update add ntpd
   Note

ntpd serves as both a client and a server

Hardware Clock

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

root # echo 'clock_hctosys="YES"' >> /etc/conf.d/hwclock
root # echo 'clock_systohc="YES"' >> /etc/conf.d/hwclock
root # rc-service hwclock restart
root # rc-update add hwclock boot

External Resources

http://keetweej.vanheusden.com/query_ntp.php