[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
howtos:network_services:ntp [2012/09/25 03:14 (UTC)] – moved page from the general howtos namespace mfillpot | howtos:network_services:ntp [2014/02/17 06:35 (UTC)] – kikinovak | ||
---|---|---|---|
Line 6: | Line 6: | ||
* configuring an NTP server on Slackware Linux; | * configuring an NTP server on Slackware Linux; | ||
* synchronizing client PCs with your local NTP server. | * synchronizing client PCs with your local NTP server. | ||
+ | |||
+ | ===== Introduction ===== | ||
+ | |||
+ | When several users manipulate shared data on different client PCs on a network, it's important that these machines are all synchronized. This is especially true if you share files over NFS, or if you use NIS for centralized authentication. You'll get all sorts of weird errors if your clocks are out of sync. Unfortunately, | ||
+ | |||
+ | That's where NTP (//Network Time Protocol//) comes in handy. It allows networked machines to adjust their clocks so as to be perfectly synchronized. A series of public time servers on the Internet allow the reception of the exact time. From this point, we can use NTP in several ways. | ||
+ | |||
+ | * The '' | ||
+ | * This one-time-adjustment isn't sufficient for a server that is supposed to be up 24/7, since its clock will drift away gradually from the exact time. In that case, we have to configure the '' | ||
+ | * The '' | ||
+ | |||
+ | It's considered good practice to use '' | ||
+ | |||
+ | ===== Firewall considerations ===== | ||
+ | |||
+ | The NTP services uses UDP port 123. Open this port if you want to allow remote machines to connect to your NTP server. | ||
===== Synchronize a LAN server or a public root server with an NTP server on the Internet ===== | ===== Synchronize a LAN server or a public root server with an NTP server on the Internet ===== | ||
Line 58: | Line 74: | ||
< | < | ||
- | # chmod 0755 / | + | # chmod +x / |
</ | </ | ||
Line 82: | Line 98: | ||
The little '' | The little '' | ||
- | === Synchronizing at boot time === | + | <note tip>The first synchronization can take a few minutes, sometimes up to half an hour.</note> |
- | If instead of using a daemon, all you want to do is to synchronize time once per boot, it is possible to add the command '' | + | |
- | + | ||
- | ~# cat /etc/ | + | |
- | #!/bin/sh | + | |
- | # | + | |
- | # / | + | |
- | # | + | |
- | # Put any local startup commands in here. Also, if you have | + | |
- | # anything that needs to be run at shutdown time you can | + | |
- | # make an / | + | |
- | # commands in there. | + | |
- | . | + | |
- | . | + | |
- | . | + | |
- | ntpd -qg & | + | |
- | <note tip>The first synchronization can take a few minutes, sometimes up to half an hour.</ | ||
===== Synchronize your client PC(s) with your local NTP server ===== | ===== Synchronize your client PC(s) with your local NTP server ===== | ||
Line 139: | Line 139: | ||
< | < | ||
- | # chmod 0755 / | + | # chmod +x / |
# / | # / | ||
</ | </ | ||
Line 154: | Line 154: | ||
<note tip> | <note tip> | ||
+ | | ||
+ | ===== Monitor the performance of ntpd ===== | ||
- | ===== Firewall considerations ===== | + | You will notice that the logfile ''/ |
- | The NTP services uses UDP port 123. Open this port if you want to allow remote machines | + | < |
+ | statsdir / | ||
+ | statistics loopstats | ||
+ | filegen loopstats file loops type day link enable | ||
+ | </ | ||
+ | |||
+ | You have to create the statsdir manually. Once the configuration changes are in effect, '' | ||
+ | < | ||
+ | 56690 3950.569 0.001199636 2.297 0.001830770 0.571576 10 | ||
+ | </ | ||
+ | |||
+ | The first and second number are the UTC time (expressed as [[http://en.wikipedia.org/ | ||
+ | |||
+ | To monitor the performance of '' | ||
+ | |||
+ | < | ||
+ | $ awk ' | ||
+ | $ awk ' | ||
+ | $ gnuplot | ||
+ | gnuplot> set xzeroaxis | ||
+ | gnuplot> plot ' | ||
+ | gnuplot> plot ' | ||
+ | </ | ||
+ | |||
+ | Given enough data, visual examination of the plots will allow you to see peculiarities in '' | ||
====== Sources ====== | ====== Sources ====== | ||
+ | |||
* Originally written by [[wiki: | * Originally written by [[wiki: | ||
+ | * Performance monitoring section contributed by Dominik Drobek | ||
<!-- Please do not modify anything below, except adding new tags.--> | <!-- Please do not modify anything below, except adding new tags.--> | ||
<!-- You must remove the tag-word " | <!-- You must remove the tag-word " | ||
- | {{tag> | + | {{tag> |