17.04.2024, 14:09 UhrDeutsch | English
Hallo Gast [ Registrierung | Anmelden ]

How to Set up a Time Server

One of my boxes kept losing 15 seconds a day .. and ntpdate on a cronjob didnt fix it, so ..
first in console as root
apt-cache search ntp

apt-get update && apt-get install  ntp ntp-doc  

update-rc.d -f ntp defaults
run update-rc.d later,after doing some configgering

Find the docs on your system at
/usr/share/doc/ntp-doc/html/index.html <- and bookmark it!

It is a large doc,and not all of it applies, but its got it all.

ntp will not activated until you reboot, but you should set your time as accurately as possible before

ntp is run as service .. ntpdate is already present on kanotix

ntp will get its time from the list of servers in /etc/ntp.conf, which is the main file to edit,
Both ntpdate and the ntpd daemon [called ntp] poll the list of timeservers near the top of /etc/ntp.conf.. heres my current list as example:

 pool.ntp.org maps to more than 100 low-stratum NTP servers.
# Your server will pick a different set every time it starts up.
#  *** Please consider joining the pool! ***
#  ***  <http://www.pool.ntp.org/#join>  ***
server ntp.blueyonder.co.uk
server uk.pool.ntp.org
server 1.uk.pool.ntp.org
server 2.uk.pool.ntp.org
server 0.europe.pool.ntp.org
server 1.europe.pool.ntp.org
server 2.europe.pool.ntp.org

The first one is the other box on my network, also running ntp [on there its 'server']
The second is the timeserver of my isp.
Next are some of the uk.pool.ntp.org, then a few europeans for good luck
By the way , your own isp-nameservers are often also timeservers
you can check this by running

ntpdate -v <ip>

This will not which change anything, but will return a time-result,something like:

# ntpdate -v
19 Sep 19:09:27 ntpdate[13329]: ntpdate 4.2.2@1.1532-o Wed Aug  9 12:08:54 UTC 2006 (1)

Then you want to allow access to your local boxes

# Local users may interrogate the ntp server more closely.
restrict nomodify
restrict 192.168.24

Now you want to broadcast:

# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)

The ntp.conf file itself is a bit odd, its treated as a diff if you just click on it
ok .. before you start ntp, you must set the time, ie

# ntpdate -u -b uk.pool.ntp.org
19 Sep 19:19:33 ntpdate[15641]: step time server offset 0.001523 sec

Then start ntp, as a service,to start at every boot [ie, reboot]
after ntp has run for a few, do:

ntpq -pn

If alls gone well, you should see something like:

# ntpq -pn
remote           refid      st t when poll reach   delay   offset  jitter
----------------------------------------------------------------------------    .INIT.          16 u    - 1024    0    0.000    0.000   0.000
+      2 u   97  128  377    7.849    1.548  30.157
*     2 u  101  128  377   17.755    0.794  24.722   .INIT.          16 u    - 1024    0    0.000    0.000   0.000
+     2 u   37  128  377   23.475    3.259  12.203
+       2 u  101  128  377   44.567   -1.366  46.922
+    3 u   90  128  377   17.208   -5.569  27.527
+   3 u   89  128  377   62.130   -0.797  39.999     .LOCL.          10 l   18   64  377    0.000    0.000   0.001   .BCST.          16 u    -   64    0    0.000    0.000   0.001

That asterisk, the *, is the active timeserver,thats deemed most worthy,and it means you are now keeping good time..and it uses port 123 .. my iptables line is

# Network Time Protocol (NTP) Server
$IPT -A udp_inbound -p UDP -s 0/0 --destination-port 123 -j ACCEPT
$IPT -A INPUT -j ACCEPT -p tcp --dport 123

Submitted by etorix
XML Revisions of $tag
Seiten-History :: Letzter Editor : etorix :: Eigentümer : cokeinthebottle ::
Powered by pnWikka 1.0
Deutsch | English
Logos and trademarks are the property of their respective owners, comments are property of their posters, the rest is © 2004 - 2006 by Jörg Schirottke (Kano).
Consult Impressum and Legal Terms for details. Kanotix is Free Software released under the GNU/GPL license.
This CMS is powered by PostNuke, all themes used at this site are released under the GNU/GPL license. designed and hosted by w3you. Our web server is running on Kanotix64-2006.