View previous topic :: View next topic |
Author |
Message |
gK Guru

Joined: 31 Jul 2002 Posts: 319 Location: France
|
Posted: Sun Oct 26, 2003 11:43 am Post subject: [NTP] Une petite mise au point s'impose ! |
|
|
Bonjour,
Je souhaite configurer ma machine pour qu'elle m'indique la bonne heure.
En fait, je connais ntp mais je m'embrouille avec pas ma lde truc, notamment :
- la différence entre ntpd et ntpdate ?
- les fichiers /etc/init.d/ntp-client et /etc/init.d/ntp-d
- le fichier /etc/ntp.conf
- le fichier /etc/rc.conf avec
Quote: |
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
# Greenwich Mean Time). If your clock is set to the local time, then set CLOCK
# to "local". This setting is used by the /etc/init.d/clock script.
CLOCK="local"
|
- enfin, le fichier /etc/conf.d/ntpd et /etc/conf.d/ntp-client
Bref, on a donc 36 fichiers et 36 solutions pour mettre à jour l'heure.
Tiens j'oublies, on peut aussi mettre ntpdate en CRON toutes les x secondes aussi non ?
Voila, si on pouvait m'expliquer clairement les différentes solutions et à quoi servent tous ces fichiers, ou alors la méthode la plus simple.
J'ai bien cherché sur google et je n'ai trouvé aucune documentation claire...  |
|
Back to top |
|
 |
aljeux n00b

Joined: 18 Mar 2003 Posts: 11
|
Posted: Sun Oct 26, 2003 11:48 am Post subject: |
|
|
J'ai choisi une autre solution qui je pense est encore plus simple, c'est d'utiliser rdate et j'ai ajouté dans le fichier /etc/ppp/ip-up.local (ou equivalent) la ligne:
Code: | /usr/bin/rdate -s ntp0.cornell.edu |
Donc, lorsque je me connecte, mon pc va se mettre a l'heure automatiquement.
Voila, au cas ou...
Alain. |
|
Back to top |
|
 |
gK Guru

Joined: 31 Jul 2002 Posts: 319 Location: France
|
Posted: Sun Oct 26, 2003 12:22 pm Post subject: |
|
|
C'est une autre solution en effet, mais tu sembles oublier ce qui passe par une passerelle et qui ne se connecte pas directement ! |
|
Back to top |
|
 |
cylgalad Veteran

Joined: 18 Apr 2003 Posts: 1327 Location: France
|
Posted: Sun Oct 26, 2003 12:27 pm Post subject: |
|
|
Pour mettre à l'heure c'est ntpdate, ou mieux /etc/init.d/ntp-client, qui peut le faire au démarrage (si la connexion à l'Internet est active, sinon un /etc/init.d/ntp-client start - ou restart - à la main sous root après connexion)
ntpd c'est un serveur d'heure, inutile si tu n'as pas une horloge atomique dans ton PC
Mon /etc/conf.d/ntp-client (configuration pour /etc/init.d/ntp-client) :
Code: |
# Copyright 1999-2002 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /home/cvsroot/gentoo-x86/net-misc/ntp/files/ntp-client.confd,v 1.2 2003/09/19 17:50:37 vapier Exp $
# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
NTPCLIENT_CMD="ntpdate"
# Options to pass to the above command
# Most people should just uncomment this variable and
# change 'someserver' to a valid hostname which you
# can aquire from the URL's below
NTPCLIENT_OPTS="-b ntp1.tuxfamily.net"
##
# A list of available servers is available here:
# http://www.eecis.udel.edu/~mills/ntp/clock2a.html
# http://www.eecis.udel.edu/~mills/ntp/servers.html
# Please follow the rules of engagement and use a
# Stratum 2 server (unless you qualify for Stratum 1)
##
|
Dans rc.conf il faut mettre "local" (surtout si tu as windoze en dual-boot...).
Je déconseille fortement de mettre ntpdate ou /etc/init.d/ntp-client dans un cron, mettre à l'heure une ou deux fois par jour est largement suffisant et tout abus pourrait conduire à la fermeture de serveurs ntp. |
|
Back to top |
|
 |
anigel Bodhisattva


Joined: 14 Apr 2003 Posts: 1894 Location: Un petit bled pas loin de Limoges ;-)
|
Posted: Sun Oct 26, 2003 1:48 pm Post subject: Re: [NTP] Une petite mise au point s'impose ! |
|
|
gK wrote: | - la différence entre ntpd et ntpdate ? |
ntpdate est le programme qui permet de demander l'heure à un serveur de temps (le client donc). ntpd est le démon qui tourne sur les serveurs en question.
gK wrote: | - les fichiers /etc/init.d/ntp-client et /etc/init.d/ntp-d |
Pour une utilisation personnelle tu n'a pas besoin de te prendre le chou, tu ne te serviras que de ntp-client.
gK wrote: | - le fichier /etc/ntp.conf |
Il me semble que sur gentoo les fichiers de conf de ntp sont /etc/conf.d (dans ton cas, /etc/conf.d/ntp-client.conf).
gK wrote: | - le fichier /etc/rc.conf avec
Quote: |
# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
# Greenwich Mean Time). If your clock is set to the local time, then set CLOCK
# to "local". This setting is used by the /etc/init.d/clock script.
CLOCK="local" |
|
Cette option du fichier rc.conf sert simplement à savoir si le BIOS de ta machein stocke l'heure au format local ou bien au format international. Mets "local" pour ne pas interférer avec Windows si tu l'as sur ta machine.
gK wrote: | Bref, on a donc 36 fichiers et 36 solutions pour mettre à jour l'heure.
Tiens j'oublies, on peut aussi mettre ntpdate en CRON toutes les x secondes aussi non ? |
Ce que tu peux faire de plus simple est de rajouter ntp-client au démarrage de ta machine :
Quote: | /etc/init.d/ntp-client start
rc-update add ntp-client default |
En espérant avoir répondu à ta question =) _________________ Il y a 10 sortes d'individus en ce bas-monde : ceux qui causent binaire, et les autres. |
|
Back to top |
|
 |
gK Guru

Joined: 31 Jul 2002 Posts: 319 Location: France
|
Posted: Sun Oct 26, 2003 2:00 pm Post subject: |
|
|
Merci pour tes réponses.
Voila ce que j'ai eu comme msg d'erreur ...
# /etc/init.d/ntp-client start
* Setting clock via the ntp client 'ntpdate'...
26 Oct 15:00:00 ntpdate[2619]: the NTP socket is in use, exiting
* Failed to set clock [ !! ] |
|
Back to top |
|
 |
anigel Bodhisattva


Joined: 14 Apr 2003 Posts: 1894 Location: Un petit bled pas loin de Limoges ;-)
|
Posted: Sun Oct 26, 2003 2:23 pm Post subject: |
|
|
Probablement car tu as déjà un outil qui utilise le port NTP (tu n'aurais pas lancé ntpd des fois ?) _________________ Il y a 10 sortes d'individus en ce bas-monde : ceux qui causent binaire, et les autres. |
|
Back to top |
|
 |
gK Guru

Joined: 31 Jul 2002 Posts: 319 Location: France
|
Posted: Sun Oct 26, 2003 2:26 pm Post subject: |
|
|
J'ai redémarré, puis tapé la commande et ça a marché.
J'ai reredémarré ensuite pour voir si sa fonctionnait mais ça ne marche pas ... Il me met comme erreur 'ntp.nerim.net est innaccessible. On pourrait croire que ça vient de ma connexion internet qui ne serait pas initialisée mais je passe par une passerelle...
Ou alors c'est à cause de ma carte réseau, dans ce cas là comment mettre le ntp après ? |
|
Back to top |
|
 |
ttgeub Guru


Joined: 20 Jan 2003 Posts: 494 Location: Eindhoven
|
Posted: Sun Oct 26, 2003 3:17 pm Post subject: |
|
|
un bon moyen pour savoir si ca marche est de lancer ntptrace qui remonte la liste des serveurs jusqu au stratus 1 |
|
Back to top |
|
 |
cylgalad Veteran

Joined: 18 Apr 2003 Posts: 1327 Location: France
|
Posted: Mon Oct 27, 2003 11:11 am Post subject: |
|
|
gK wrote: | Merci pour tes réponses.
Voila ce que j'ai eu comme msg d'erreur ...
# /etc/init.d/ntp-client start
* Setting clock via the ntp client 'ntpdate'...
26 Oct 15:00:00 ntpdate[2619]: the NTP socket is in use, exiting
* Failed to set clock [ !! ] |
Et redemarrer ne solutionne pas les problèmes, on n'est pas sous windoze  |
|
Back to top |
|
 |
|