Installation et configuration d`un serveur NTP
Transcription
Installation et configuration d`un serveur NTP
Installation et configuration d’un serveur NTP Présentation de NTP Le NTP est un protocole permettant de synchroniser l'horloge d'un ordinateur avec celle d'un serveur de référence. NTP est un protocole basé sur UDP et utilise le port 123. Le protocole NTP comprend : une partie architecture, une partie messagerie, et une partie algorithmique. (Source Wiki) Spécification : -Serveur de temps NTP : une machine Debian (mars) -Clients NTP : une machine Debian (sur le réseau 10.11.12.0/?) une machine CentOS (sur le réseau 20.22.23.0/?) BOURICHE KHALID 1 Installation du serveur de temps "NTP". Commande : aptitude install ntp Installation du service. vim /etc/ntp.conf Fichier de configuration du serveur. On ajoute par exemple les serveurs du Québec : server ntp1.cmc.ec.gc.ca server ntp2.cmc.ec.qc.ca Le fichier de configuration doit ressembler à ceci : # /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help driftfile /var/lib/ntp/ntp.drift # Enable this if you want statistics to be logged. #statsdir /var/log/ntpstats/ # Création du fichier log logfile /var/log/ntpd.log statistics loopstats peerstats clockstats filegen loopstats file loopstats type day enable filegen peerstats file peerstats type day enable filegen clockstats file clockstats type day enable # You do need to talk to an NTP server or two (or three). #server ntp.your-provider.example # pool.ntp.org maps to about 1000 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.html> server ntp1.cmc.ec.gc.ca server ntp2.cmc.ec.qc.ca server 0.debian.pool.ntp.org iburst server 1.debian.pool.ntp.org iburst server 2.debian.pool.ntp.org iburst server 3.debian.pool.ntp.org iburst # Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for BOURICHE KHALID 2 # details. The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions> # might also be helpful. # Note that "restrict" applies to both servers and clients, so a configuration # that might be intended to block requests from certain clients could also end # up blocking replies from your own upstream servers. # By default, exchange time with everybody, but don't allow configuration. restrict -4 default kod notrap nomodify nopeer noquery restrict -6 default kod notrap nomodify nopeer noquery # Local users may interrogate the ntp server more closely. restrict 127.0.0.1 restrict ::1 # Clients from this (example!) subnet have unlimited access, but only if # cryptographically authenticated. #restrict 192.168.123.0 mask 255.255.255.0 notrust restrict 10.11.12.0 mask 255.255.255.0 nomodify notrap restrict 20.22.23.0 mask 255.255.255.0 nomodify notrap # If you want to provide time to your local subnet, change the next line. # (Again, the address is an example only.) #broadcast 192.168.123.255 broadcast 10.11.12.255 broadcast 20.22.23.255 # If you want to listen to time broadcasts on your local subnet, de-comment the # next lines. Please do this only if you trust everybody on the network! #disable auth #broadcastclient Redémarrage du serveur NTP: Commande : service ntp restart BOURICHE KHALID 3 Vérification du bon fonctionnement du serveur NTP. Commande : ntpq -p Démonstration de la synchronisation du serveur "mars" avec internet : Commande : tshark -f "udp port 123" NB : Le serveur fonctionne correctement, car il essaye de se synchroniser avec un serveur à l'extérieur de réseaux, c'est-à-dire sur internet. Configuration NTP des clients pour la synchronisation avec le serveur "mars". Commande : aptitude install ntp Pour client Debian. yum install ntp Pour client Centos. vim /etc/ntp.conf BOURICHE KHALID 4 Dans le fichier, il faut désactiver les serveurs de temps et ajouté : server 10.11.12.1 Pour ceux qui sont localisé dans Internal LAN. # You do need to talk to an NTP server or two (or three). #server ntp.your-provider.example # pool.ntp.org maps to about 1000 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.html> ##server 0.debian.pool.ntp.org iburst ##server 1.debian.pool.ntp.org iburst ##server 2.debian.pool.ntp.org iburst ##server 3.debian.pool.ntp.org iburst ## Serveur NTP "MARS" server 10.11.12.1 Dans le fichier, il faut désactiver les serveurs de temps et ajouté server 20.22.23.1 Pour ceux qui sont localisé dans DMZ LAN. # You do need to talk to an NTP server or two (or three). #server ntp.your-provider.example # pool.ntp.org maps to about 1000 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.html> ##server 0.debian.pool.ntp.org iburst ##server 1.debian.pool.ntp.org iburst ##server 2.debian.pool.ntp.org iburst ##server 3.debian.pool.ntp.org iburst ## Serveur NTP "MARS" server 20.22.23.1 Redémarrage du service NTP sur les stations clients : Commande : service ntp restart Pour client Debian. service ntpd restart Pour client Centos. BOURICHE KHALID 5 Références http://fr.wikipedia.org/wiki/Network_Time_Protocol http://irp.nain-t.net/doku.php/330ntp:start BOURICHE KHALID 6