https://wiki.archlinux.org/api.php?action=feedcontributions&user=Bvanheu&feedformat=atomArchWiki - User contributions [en]2024-03-29T11:41:34ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Puppet&diff=451337Puppet2016-09-21T04:20:50Z<p>Bvanheu: formatting on bindaddress</p>
<hr />
<div>[[Category:System administration]]<br />
[[ja:Puppet]]<br />
{{Stub}}<br />
{{Related articles start}}<br />
{{Related|Puppet Dashboard}}<br />
{{Related articles end}}<br />
From [https://puppetlabs.com/puppet/what-is-puppet/ Puppet web site]:<br />
:''Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.''<br />
<br />
== Installation ==<br />
<br />
{{pkg|puppet}} is available in the official repositories.<br />
<br />
If you want to install from Puppet's git repo, {{AUR|puppet-git}} is available through the [[AUR]].<br />
<br />
== Configuration ==<br />
<br />
Puppet's main configuration file is {{ic|puppet.conf}} which is located at {{ic|/etc/puppetlabs/puppet/puppet.conf}}.<br />
<br />
There are 3 sections to place settings depending if it is a master/agent: {{ic|[main]}}, {{ic|[agent]}} and {{ic|[master]}}.<br />
<br />
Bare minimum of settings are:<br />
* server: The hostname of the puppet server. Default: {{ic|puppet}}<br />
* report: Most users should set this to true.<br />
* pluginsync: Most users should set this to true.<br />
* certname: The certified name of the machine (unique identifier). Default: {{ic|fqdn}}<br />
<br />
Puppet will look for node configuration in {{ic|/etc/puppetlabs/code/environments/production/manifests/site.pp}}.<br />
<br />
After starting puppet by daemon/cron/standalone, it will generate<br />
certificates in {{ic|/etc/puppetlabs/puppet/ssl/}} directory.<br />
You need to accept this certificate in the puppet master with:<br />
{{ic|sudo puppet cert sign <name>}}.<br />
<br />
Notes on ''bindaddress'' for puppet master.<br />
<br />
The default value for ''bindaddress'' is "0.0.0.0", which makes puppet listen on IPv4 only: {{ic|1=bindaddress = 0.0.0.0}}<br />
<br />
To make puppet master listen on IPv6, set the ''binaddress'' value to: {{ic|1=bindaddress = ::}}<br />
<br />
To make puppet listen on both interface, set the value to: {{ic|1=bindaddress = *}}<br />
<br />
== Facter ==<br />
<br />
Facter is a companion program of puppet that gathers facts about the system it runs on.<br><br />
commands: <br />
# puppet facts find facter<br />
# facter -p<br />
<br />
{{Note|Facter is installed by default as a dependency of {{pkg|puppet}}.}}<br />
<br />
== Puppet Resources ==<br />
===Packages===<br />
<br />
"Pacman" is supported by puppet. Installing packages works out of the box since puppet 3.1.0.<br />
<br />
===Services===<br />
<br />
Since puppet 3.2.1 systemd on archlinux is fully supported.<br><br />
The systemd provider in Puppet today only uses two commands for the service enable state:<br><br />
systemctl is-enabled <unit>, checking return code for the current enable state<br><br />
systemctl enable/disable <unit> to change it.<br />
<br />
Otherwise service running will use:<br />
# systemctl start/stop/restart <unit><br />
<br />
Using the full unit name unit.service is supported.<br />
<br />
==PuppetDB ==<br />
PuppetDB is the fast, scalable, and reliable data warehouse for Puppet.<br> <br />
It caches data generated by Puppet, and gives you advanced features at awesome speed with a powerful API.<br><br />
Puppetdb is in aur install {{AUR|puppetdb}} and {{AUR|puppetdb-terminus}} <br><br />
[More information: https://github.com/puppetlabs/puppetdb]</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Puppet&diff=451336Puppet2016-09-21T04:16:37Z<p>Bvanheu: precision on bindaddress for puppet master</p>
<hr />
<div>[[Category:System administration]]<br />
[[ja:Puppet]]<br />
{{Stub}}<br />
{{Related articles start}}<br />
{{Related|Puppet Dashboard}}<br />
{{Related articles end}}<br />
From [https://puppetlabs.com/puppet/what-is-puppet/ Puppet web site]:<br />
:''Puppet is IT automation software that helps system administrators manage infrastructure throughout its lifecycle, from provisioning and configuration to patch management and compliance. Using Puppet, you can easily automate repetitive tasks, quickly deploy critical applications, and proactively manage change, scaling from 10s of servers to 1000s, on-premise or in the cloud.''<br />
<br />
== Installation ==<br />
<br />
{{pkg|puppet}} is available in the official repositories.<br />
<br />
If you want to install from Puppet's git repo, {{AUR|puppet-git}} is available through the [[AUR]].<br />
<br />
== Configuration ==<br />
<br />
Puppet's main configuration file is {{ic|puppet.conf}} which is located at {{ic|/etc/puppetlabs/puppet/puppet.conf}}.<br />
<br />
There are 3 sections to place settings depending if it is a master/agent: {{ic|[main]}}, {{ic|[agent]}} and {{ic|[master]}}.<br />
<br />
Bare minimum of settings are:<br />
* server: The hostname of the puppet server. Default: {{ic|puppet}}<br />
* report: Most users should set this to true.<br />
* pluginsync: Most users should set this to true.<br />
* certname: The certified name of the machine (unique identifier). Default: {{ic|fqdn}}<br />
<br />
Puppet will look for node configuration in {{ic|/etc/puppetlabs/code/environments/production/manifests/site.pp}}.<br />
<br />
After starting puppet by daemon/cron/standalone, it will generate<br />
certificates in {{ic|/etc/puppetlabs/puppet/ssl/}} directory.<br />
You need to accept this certificate in the puppet master with:<br />
{{ic|sudo puppet cert sign <name>}}.<br />
<br />
Notes on ''bindaddress'' for puppet master: the default value for ''bindaddress'' is "0.0.0.0", which makes puppet listen on IPv4 only. To make puppet master listen on IPv6, set the ''binaddress'' value to "::". To make puppet listen on both interface, set the value to "*".<br />
<br />
== Facter ==<br />
<br />
Facter is a companion program of puppet that gathers facts about the system it runs on.<br><br />
commands: <br />
# puppet facts find facter<br />
# facter -p<br />
<br />
{{Note|Facter is installed by default as a dependency of {{pkg|puppet}}.}}<br />
<br />
== Puppet Resources ==<br />
===Packages===<br />
<br />
"Pacman" is supported by puppet. Installing packages works out of the box since puppet 3.1.0.<br />
<br />
===Services===<br />
<br />
Since puppet 3.2.1 systemd on archlinux is fully supported.<br><br />
The systemd provider in Puppet today only uses two commands for the service enable state:<br><br />
systemctl is-enabled <unit>, checking return code for the current enable state<br><br />
systemctl enable/disable <unit> to change it.<br />
<br />
Otherwise service running will use:<br />
# systemctl start/stop/restart <unit><br />
<br />
Using the full unit name unit.service is supported.<br />
<br />
==PuppetDB ==<br />
PuppetDB is the fast, scalable, and reliable data warehouse for Puppet.<br> <br />
It caches data generated by Puppet, and gives you advanced features at awesome speed with a powerful API.<br><br />
Puppetdb is in aur install {{AUR|puppetdb}} and {{AUR|puppetdb-terminus}} <br><br />
[More information: https://github.com/puppetlabs/puppetdb]</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Brother_HL-2270DW&diff=232570Brother HL-2270DW2012-10-30T20:39:58Z<p>Bvanheu: /* Using IPP */</p>
<hr />
<div>[[Category:Printers]]<br />
This is a short tutorial on installing the Brother HL-2270DW printer with [[CUPS]] on Arch Linux.<br />
<br />
==Installing printer drive==<br />
Install rpmextract<br />
<pre># pacman -S rpmextract</pre><br />
<br />
Download printer driver from the Brother website<br />
<pre>$ mkdir ~/brother && cd ~/brother<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Extract those rpm<br />
<pre><br />
$ rpmextract cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ rpmextract hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Copy files in /usr/local<br />
<pre><br />
$ sudo cp -R ./usr/local/Brother /usr/local<br />
</pre><br />
<br />
Use this PPD and cups filter, extracted from Brother installation script<br />
<pre><br />
$ wget https://raw.github.com/bvanheu/brother/master/HL2270DW/HL2270.PPD<br />
$ wget https://raw.github.com/bvanheu/brother/master/HL2270DW/brlpdwrapperHL2270DW<br />
$ chmod +x brlpdwrapperHL2270DW<br />
$ sudo cp brlpdwrapperHL2270DW /usr/lib/cups/filter/<br />
$ sudo cp HL2270.PPD /usr/share/cups/model/<br />
</pre><br />
<br />
==Setup printer and CUPS==<br />
{{Note|This article details how to setup you printer over a LAN or WLAN connection.}} <br />
<br />
This printer has a web-based interface. To avoid some extra Google queries, the HL-2270DW web interface default username is 'admin' and the default password is 'access'.<br />
<br />
It is recommended that you configure the HL-2270DW to have a '''static IP''' so that CUPS will always work with it (steps not detailed in this article).<br />
<br />
# Install CUPS and Foomatic: <pre># pacman -S cups a2ps</pre><br />
# Start the cups daemon: <pre># systemctl start cups</pre><br />
# Open a web browser to http://localhost:631/<br />
# Click the Add Printer button on the Administration tab.<br />
<br />
===Using IPP===<br />
# Select IPP from the list.<br />
# In the 'Connection' field, type <pre>ipp://THE_PRINTER_IP/ipp/port1</pre><br />
# In the next form, give the printer a unique name (no spaces and the name be must unique from any identical printers), and select '''"Brother"''' from the printer make field.<br />
# Select '''"Brother HL-2270DW for CUPS (en)"''' from the list of drivers.<br />
# Configure the default options on the next page to your liking<br />
## Set '''Duplex''' to DuplexNoTumble for double-side printing<br />
## Set '''TonerSave''' to on to enable toner saving<br />
<br />
==Troubleshooting==<br />
''Some simple reminders''<br />
# Sometimes if you get simple errors like "spool not ready" or "ipp backend failed", there is a good chance you have to resume the printer by selecting the Maintenance drop down and selecting Resume Printer.</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Brother_HL-2270DW&diff=232568Brother HL-2270DW2012-10-30T20:36:48Z<p>Bvanheu: /* Installing printer drive */ Added PPD and cups filter</p>
<hr />
<div>[[Category:Printers]]<br />
This is a short tutorial on installing the Brother HL-2270DW printer with [[CUPS]] on Arch Linux.<br />
<br />
==Installing printer drive==<br />
Install rpmextract<br />
<pre># pacman -S rpmextract</pre><br />
<br />
Download printer driver from the Brother website<br />
<pre>$ mkdir ~/brother && cd ~/brother<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Extract those rpm<br />
<pre><br />
$ rpmextract cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ rpmextract hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Copy files in /usr/local<br />
<pre><br />
$ sudo cp -R ./usr/local/Brother /usr/local<br />
</pre><br />
<br />
Use this PPD and cups filter, extracted from Brother installation script<br />
<pre><br />
$ wget https://raw.github.com/bvanheu/brother/master/HL2270DW/HL2270.PPD<br />
$ wget https://raw.github.com/bvanheu/brother/master/HL2270DW/brlpdwrapperHL2270DW<br />
$ chmod +x brlpdwrapperHL2270DW<br />
$ sudo cp brlpdwrapperHL2270DW /usr/lib/cups/filter/<br />
$ sudo cp HL2270.PPD /usr/share/cups/model/<br />
</pre><br />
<br />
==Setup printer and CUPS==<br />
{{Note|This article details how to setup you printer over a LAN or WLAN connection.}} <br />
<br />
This printer has a web-based interface. To avoid some extra Google queries, the HL-2270DW web interface default username is 'admin' and the default password is 'access'.<br />
<br />
It is recommended that you configure the HL-2270DW to have a '''static IP''' so that CUPS will always work with it (steps not detailed in this article).<br />
<br />
# Install CUPS and Foomatic: <pre># pacman -S cups a2ps</pre><br />
# Start the cups daemon: <pre># systemctl start cups</pre><br />
# Open a web browser to http://localhost:631/<br />
# Click the Add Printer button on the Administration tab.<br />
<br />
===Using IPP===<br />
# Select IPP from the list.<br />
# In the 'Connection' field, type <pre>ipp://THE_PRINTER_IP/ipp/port1</pre><br />
# In the next form, give the printer a unique name (no spaces and the name be must unique from any identical printers), and select '''"Brother"''' from the printer make field.<br />
# Select '''"Brother HL-2170W Foomatic/hl1250"''' from the list of drivers.<br />
# Configure the default options on the next page to your liking.<br />
<br />
==Troubleshooting==<br />
''Some simple reminders''<br />
# Sometimes if you get simple errors like "spool not ready" or "ipp backend failed", there is a good chance you have to resume the printer by selecting the Maintenance drop down and selecting Resume Printer.</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Brother_HL-2270DW&diff=232567Brother HL-2270DW2012-10-30T20:23:14Z<p>Bvanheu: Added step to install the printer files</p>
<hr />
<div>[[Category:Printers]]<br />
This is a short tutorial on installing the Brother HL-2270DW printer with [[CUPS]] on Arch Linux.<br />
<br />
==Installing printer drive==<br />
Install rpmextract<br />
<pre># pacman -S rpmextract</pre><br />
<br />
Download printer driver from the Brother website<br />
<pre>$ mkdir ~/brother && cd ~/brother<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ wget http://www.brother.com/pub/bsc/linux/dlf/hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Extract those rpm<br />
<pre><br />
$ rpmextract cupswrapperHL2270DW-2.0.4-2.i386.rpm<br />
$ rpmextract hl2270dwlpr-2.1.0-1.i386.rpm<br />
</pre><br />
<br />
Copy files in /usr/local<br />
<pre><br />
$ sudo cp -R ./usr/local/Brother /usr/local<br />
</pre><br />
<br />
Extract PPD and cups filter from a script<br />
<br />
<br />
==Setup printer and CUPS==<br />
{{Note|This article details how to setup you printer over a LAN or WLAN connection.}} <br />
<br />
This printer has a web-based interface. To avoid some extra Google queries, the HL-2270DW web interface default username is 'admin' and the default password is 'access'.<br />
<br />
It is recommended that you configure the HL-2270DW to have a '''static IP''' so that CUPS will always work with it (steps not detailed in this article).<br />
<br />
# Install CUPS and Foomatic: <pre># pacman -S cups a2ps</pre><br />
# Start the cups daemon: <pre># systemctl start cups</pre><br />
# Open a web browser to http://localhost:631/<br />
# Click the Add Printer button on the Administration tab.<br />
<br />
===Using IPP===<br />
# Select IPP from the list.<br />
# In the 'Connection' field, type <pre>ipp://THE_PRINTER_IP/ipp/port1</pre><br />
# In the next form, give the printer a unique name (no spaces and the name be must unique from any identical printers), and select '''"Brother"''' from the printer make field.<br />
# Select '''"Brother HL-2170W Foomatic/hl1250"''' from the list of drivers.<br />
# Configure the default options on the next page to your liking.<br />
<br />
==Troubleshooting==<br />
''Some simple reminders''<br />
# Sometimes if you get simple errors like "spool not ready" or "ipp backend failed", there is a good chance you have to resume the printer by selecting the Maintenance drop down and selecting Resume Printer.</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Brother_HL-2270DW&diff=232565Brother HL-2270DW2012-10-30T20:16:35Z<p>Bvanheu: Tutorial on installing Brother HL2270DW</p>
<hr />
<div>[[Category:Printers]]<br />
<br />
This is a short tutorial on installing the Brother HL-2270DW printer with [[CUPS]] on Arch Linux.<br />
<br />
==Installing printer drive==<br />
<br />
<br />
==Setup printer and CUPS==<br />
{{Note|This article details how to setup you printer over a LAN or WLAN connection.}} <br />
<br />
This printer has a web-based interface. To avoid some extra Google queries, the HL-2270DW web interface default username is 'admin' and the default password is 'access'.<br />
<br />
It is recommended that you configure the HL-2270DW to have a '''static IP''' so that CUPS will always work with it (steps not detailed in this article).<br />
<br />
# Install CUPS and Foomatic: <pre># pacman -S cups a2ps</pre><br />
# Start the cups daemon: <pre># systemctl start cups</pre><br />
# Open a web browser to http://localhost:631/<br />
# Click the Add Printer button on the Administration tab.<br />
<br />
===Using IPP===<br />
# Select IPP from the list.<br />
# In the 'Connection' field, type <pre>ipp://THE_PRINTER_IP/ipp/port1</pre><br />
# In the next form, give the printer a unique name (no spaces and the name be must unique from any identical printers), and select '''"Brother"''' from the printer make field.<br />
# Select '''"Brother HL-2170W Foomatic/hl1250"''' from the list of drivers.<br />
# Configure the default options on the next page to your liking.<br />
<br />
==Troubleshooting==<br />
''Some simple reminders''<br />
# Sometimes if you get simple errors like "spool not ready" or "ipp backend failed", there is a good chance you have to resume the printer by selecting the Maintenance drop down and selecting Resume Printer.</div>Bvanheuhttps://wiki.archlinux.org/index.php?title=Network_Time_Protocol&diff=107638Network Time Protocol2010-05-31T03:08:04Z<p>Bvanheu: updated ntp pool server list</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:Daemons and system services (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|Network Time Protocol}}<br />
<br />
This article describes two different methods to synchronize the Linux software clock (system clock) to internet time servers. For more information on computer timekeeping, see [[Time]]. OpenNTPD (part of the OpenBSD project) is explained first and then the traditional ntpd is explained. Both daemons can sync the local clock and act as a time server if needed. OpenNTPD is designed to be simple and secure, while ntpd has a larger set of features. <br />
<br />
== OpenNTPD ==<br />
<br />
=== Installation ===<br />
<br />
OpenNTPD is not currently maintained for Linux (see [http://bbs.archlinux.org/viewtopic.php?id=68627 this thread]).<br />
<br />
First, the OpenNTPD package must be installed from the community repository:<br />
<br />
# pacman -S openntpd<br />
<br />
The default configuration is actually usable if all you want is to sync the time of the local computer. For more detailed settings, the {{Filename|/etc/ntpd.conf}} file must be edited:<br />
<br />
To sync to a particular server, uncomment and edit the "server" directive. You can find the server's URL in your area at [http://www.pool.ntp.org/zone/@ www.pool.ntp.org/zone/@].<br />
<br />
server ntp.example.org<br />
<br />
The "servers" directive works the same as the "server" directive, however, if the DNS name resolves to multiple IP address, ALL of them will be synced to. The default, "pool.ntp.org" is working and should be acceptable in most cases.<br />
<br />
pool.ntp.org<br />
<br />
Any number of "server" or "servers" directives may be used.<br />
<br />
If you want the computer you run OpenNTPD on to also be a time server, simply uncomment and edit the "listen" directive.<br />
<br />
For example:<br />
<br />
listen on *<br />
<br />
will listen on all interfaces, and<br />
<br />
listen on 127.0.0.1<br />
<br />
will only listen on the loopback interface.<br />
<br />
Your time server will only begin to serve time after it has synchronized itself to a high resolution. This may take hours, or days, depending on the accuracy of your system.<br />
<br />
If you would like to run OpenNTPD at boot, add {{Codeline|openntpd}} the DAEMONS variable in your {{Filename|/etc/rc.conf}} following your network daemon.<br />
<br />
DAEMONS=(syslog-ng network '''openntpd''' ...)<br />
<br />
If openntpd is being used to set local system time only, it may be safely backgrounded.<br />
<br />
DAEMONS=(syslog-ng network '''@openntpd''' ...)<br />
<br />
To see the status of NTP syncing, visit {{Filename|/var/log/daemon.log}} and look for entries with "ntpd".<br />
<br />
OpenNTPD adjusts the clock by small amounts at a time. It is designed this way to prevent sudden, large time fluctuations in your system, which could adversely affect system services (e.g., cron jobs). Thus, it can take some time to correct the time.<br />
<br />
If your clock is off by more than 180 seconds you can try "{{Codeline|ntpd -s -d}}" in the console. If ntpd is already running, you can simply restart it with {{Codeline|sudo /etc/rc.d/openntpd restart}}, as the Arch openntpd package uses the "-s" flag by default. See {{Codeline|man ntpd}} for more info. You can also set the [[Time#Time_Set|system clock]] to as close to possible to the actual time and then let OpenNTPD fine tune the time.<br />
<br />
=== Troubleshooting ===<br />
<br />
'''Error adjusting time'''<br />
<br />
If you find your time set incorrectly and in log you see:<br />
<br />
openntpd adjtime failed: Invalid argument<br />
<br />
Try:<br />
<br />
ntpd -s -d<br />
<br />
'''Increasing time shift'''<br />
<br />
Starting ''openntpd'' in the background could lead to synchronization errors between the actual time and the time stored on your computer. If you recognize an increasing time difference between your desktop clock and the actual time, try to start the ''openntpd'' daemon normal and not in the background.<br />
<br />
'''Initialization Failure'''<br />
<br />
Openntpd may fail to initialize properly if it is started before the network is fully configured. In some cases you may want to remove {{Codeline|openntpd}} from the DAEMONS array in {{Filename|/etc/rc.conf}} and add the following line to {{Filename|/etc/rc.local}}:<br />
<br />
(sleep 300 && /etc/rc.d/openntpd start) &<br />
<br />
This will wait 5 minutes before starting openntpd, which should give the system sufficient time to set up the network properly. If your network settings change often, you may also consider restarting the daemon regularly with cron. The next section has a few ways of controlling the daemon.<br />
<br />
=== Making openntpd dependent upon network access ===<br />
<br />
If you have intermittent network access (you roam around on a laptop, you use dial-up, etc), it does not make sense to have {{Codeline|openntpd}} running as a system daemon on start up. Here are a few ways you can control {{Codeline|openntpd}} based on the presence of a network connection. These instructions should also work for {{Codeline|ntpd}} found further below. <br />
<br />
==== Using netcfg ====<br />
<br />
If you are using netcfg, you can also start/stop openntpd as a POST_UP/PRE_DOWN command in your network profile:<br />
<br />
POST_UP="/etc/rc.d/openntpd start || true"<br />
PRE_DOWN="/etc/rc.d/openntpd stop || true"<br />
<br />
Of course, you will have to specify this manually for each network profile.<br />
<br />
==== Using NetworkManager dispatcher ====<br />
<br />
OpenNTPD can be brought up/down along with a network connection through the use of NetworkManager's dispatcher scripts. Place the following slightly modified {{Filename|/etc/rc.d/openntpd}} script as {{Filename|/etc/NetworkManager/dispatcher.d/openntpd-dispatch}}<br />
<br />
<pre><br />
#!/bin/bash<br />
<br />
CONF=/etc/conf.d/openntpd<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
[ -f $CONF ] && . $CONF<br />
<br />
PID=`pidof -o %PPID /usr/sbin/ntpd`<br />
case "$2" in<br />
up)<br />
stat_busy "Starting OpenNTPD"<br />
[ -z "$PID" ] && /usr/sbin/ntpd $PARAMS<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
PID=`pidof -o %PPID /usr/sbin/ntpd`<br />
echo $PID >/var/run/openntpd.pid<br />
add_daemon openntpd<br />
stat_done<br />
fi<br />
;;<br />
down)<br />
stat_busy "Stopping OpenNTPD"<br />
[ ! -z "$PID" ] && kill $PID &>/dev/null<br />
if [ $? -gt 0 ]; then<br />
stat_fail<br />
else<br />
rm_daemon openntpd<br />
stat_done<br />
fi<br />
;;<br />
*)<br />
echo "usage: $0 {up|down}" <br />
esac<br />
exit 0<br />
</pre><br />
<br />
==== Using wicd ====<br />
These instructions require wicd 1.7.0 or later, which is available in the standard Arch repository.<br />
You will also need write access to {{Filename|/etc/wicd/scripts}}.<br />
<br />
{{Note|Remember to make these two scripts executable using {{Codeline|chmod}} }}<br />
<br />
Make one shell script inside {{Filename|/etc/wicd/scripts/postconnect/openntpd-start.sh}} with the following:<br />
<pre><br />
#!/bin/sh<br />
/etc/rc.d/openntpd start<br />
</pre><br />
<br />
Similarly, make another shell script inside {{Filename|/etc/wicd/scripts/predisconnect/openntpd-stop.sh}} with the following:<br />
<pre><br />
#!/bin/sh<br />
/etc/rc.d/openntpd stop<br />
</pre><br />
<br />
=== Cron job instead of daemon ===<br />
<br />
Running OpenNTPD as a daemon may not always be desirable if you have a special way you configure your network, or if you have a bad hardware clock. You can add a [[cron]] job that will update the system clock hourly, daily..., set the hardware clock, and remove the [[Time#Time_Skew|time drift]] file. Open your root crontab by typing "crontab -e" into terminal and (for example) to have your time set at 12:03am daily:<br />
<br />
03 00 * * * ntpd -s && hwclock -w && rm /var/lib/hwclock/adjtime<br />
<br />
== ntpd ==<br />
===Installation===<br />
The {{Package Official|ntp}} package is available from [extra]:<br />
<br />
# pacman -S ntp<br />
<br />
===/etc/ntp.conf===<br />
The first line in your ntp.conf file should contain the following line:<br />
<br />
restrict default kod nomodify notrap nopeer noquery<br />
<br />
This restricts everyone from modifying anything and prevents everyone from querying your time server. In the past "notrust" was used here too, but the function of this option has changed to mean authentication with a key is required.<br />
<br />
Following this line, you need to tell ntpd what to allow through into your server.<br />
<br />
restrict 127.0.0.1<br />
restrict 1.2.3.4 nomodify<br />
restrict 192.168.0.0 mask 255.255.255.0 nomodify<br />
<br />
This tells ntpd that 1.2.3.4 and all IP addresses from the 192.168.0.0 range will be allowed to synchronize on this server, but they will not be allowed to modify anything. All other IP addresses in the world will still obey the default restrictions (the first line in the ntp.conf).<br />
<br />
Now, is where the stratum 2 servers that our server will synchronize with come into play. The lines in ntp.conf will be used to tell ntpd what servers we would like to use for synchronizing (these are just examples; use ntp servers that are closest to your location). Please see http://support.ntp.org/bin/view/Servers/NTPPoolServers for a list a closer servers. The iburst option is recommended, and sends a burst of packets if it cannot obtain a connection with the first attempt. The "burst" option should never be used without explicit permission and will likely result in blacklisting. <br />
<br />
server ntp1.cs.wisc.edu iburst<br />
server ntp3.cs.wisc.edu iburst<br />
server ntp3.sf-bay.org iburst<br />
<br />
Unless you have a good reason not to, it is advisable to use the pool.ntp.org servers: http://www.pool.ntp.org/.<br />
Alternatively, a list of ntp servers is available at http://www.eecis.udel.edu/~mills/ntp/clock2a.html. Please pay attention to the Access Policies. <br />
<br />
The only thing left to do is add the drift file (which keeps track of yours clocks time deviation) and the log file location:<br />
driftfile /etc/ntp.drift<br />
logfile /var/log/ntp.log<br />
<br />
In case our server loses internet access, we need to add localhost as a server or it will stop serving time to the network. We add localhost as a "stratum 10" server so that it will never be used unless internet access is lost.<br />
<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
<br />
The complete file will look like this:<br />
<br />
<pre><br />
## default restrictions<br />
restrict default kod nomodify notrap nopeer noquery<br />
<br />
## override the default restrictions here<br />
restrict 127.0.0.1<br />
## serve time to a local network<br />
#restrict 192.168.0.0 mask 255.255.255.0 nomodify<br />
<br />
## public NTP servers to sync with (all stratum 2)<br />
## change these to servers near you or comment them out<br />
server ntp1.cs.wisc.edu iburst<br />
server ntp3.cs.wisc.edu iburst<br />
server ntp3.sf-bay.org iburst<br />
<br />
## ntp pool servers<br />
server 0.pool.ntp.org iburst<br />
server 1.pool.ntp.org iburst<br />
server 2.pool.ntp.org iburst<br />
server 3.pool.ntp.org iburst<br />
<br />
## local server<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10<br />
<br />
## NTP drift file - corrects for hardware clock time deviation<br />
driftfile /etc/ntp.drift<br />
<br />
## NTP log file<br />
logfile /var/log/ntp.log<br />
</pre><br />
<br />
===/etc/rc.conf===<br />
<br />
Add ntpd to the DAEMONS array in rc.conf to have it start on boot:<br />
DAEMONS=(syslog-ng network '''ntpd''' ...)<br />
<br />
Note that before starting ntpd for the first time, you should set the time to a sane starting point (within a few minutes) manually, or using ntpdate. ntpd will not modify the time if it is too far off in order to prevent causing problems.<br />
<br />
If your clock tends to drift too far during shutdown, you should add ntpdate before ntpd in the DAEMONS array. '''Do not add ntpdate to the daemons array if your hardware clock works fine, it is just a workaround for faulty hardware or a dead CMOS battery.'''<br />
<br />
DAEMONS=(syslog-ng network '''ntpdate''' '''ntpd''' ...)<br />
<br />
Do not background ntpdate, because it uses the same port as ntpd and will prevent it from starting.<br />
<br />
===/etc/conf.d/ntp-client.conf===<br />
This is for /etc/rc.d/ntpdate configuration. Edit NTP_CLIENT_SERVER for your ntp server. <br />
<pre><br />
# change this to a server closer to your location<br />
NTP_CLIENT_SERVER="pool.ntp.org"<br />
<br />
# client options<br />
NTP_CLIENT_OPTION="-b -u"<br />
<br />
# timeout for the ntp-client<br />
NTPCLIENT_TIMEOUT=10<br />
<br />
# arguments passed to ntpd when started<br />
NTPD_ARGS="-g"<br />
</pre><br />
<br />
==External links==<br />
* http://www.ntp.org/<br />
* http://twiki.ntp.org/bin/view/Main/WebHome<br />
* http://www.eecis.udel.edu/~mills/ntp/html/index.html<br />
* http://www.openntpd.org</div>Bvanheu