Differences

This shows you the differences between two versions of the page.

Link to this comparison view

saisp:labs:03:contents:01 [2014/03/09 14:04]
mihai.carabas [01. Lorem ipsum]
saisp:labs:03:contents:01 [2014/03/10 04:16] (current)
mihai.carabas [01. Sincronizare ceasuri echipamente monitorizate]
Line 1: Line 1:
-==== 01. Sincronizare ceasuri echipamente monitorizate ====+==== 01. [10p] Sincronizare ceasuri echipamente monitorizate ====
  
-...+Înainte de a implementa o soluție de monitorizare centralizată,​ trebuie să ne asigurăm că **ceasurile** tuturor sistemelor din rețea sunt sincronizateÎn caz contrar, evenimentele monitorizate nu vor putea fi corelate.
  
 +Protocolul care realizeaza acest lucru este ''​NTP''​ (Network Time Protocol). De obicei, o stație are rolul de server NTP, iar echipamentele sunt clienți NTP. În topologia prezentată anterior stația ''​monitor''​ va avea rol de server de NTP, iar ruterele ''​R1''​ și ''​R2''​ și stația ''​gateway''​ vor avea rolul de clienți.
  
 +În sistemele Debian-base,​ pachetul ''​ntp''​ conține atât serverul, cât și clientul de NTP. Funcționalitatea implicită este următoarea:​
 +  * clientul obtine ceasul de la niște servere predefinite;​
 +  * serverul acceptă interogari de la alți clienți pe portul ''​UDP 123''​.
 +
 +Pe ambele stații Linux vom instala pachetul ''​ntp'':<​code bash>
 +root@monitor:​~#​ apt-get install ntp
 +
 +root@gateway:​~#​ apt-get install ntp
 +</​code>​
 +
 +Pe ''​gateway''​ configurăm serviciul NTP să foloseasca stația ''​monitor''​ ca server de NTP. În fișierul ''/​etc/​ntp.conf''​ comentăm toate liniile de încep cu ''​server''​ și adăugăm linia ''​server 192.168.1.4''​. Resetați serviciul ''​ntp'':<​code bash>
 +root@gateway:​~#​ cat /​etc/​ntp.conf |grep 192.168
 +server 192.168.1.4 iburst
 +root@gateway:​~#​ /​etc/​init.d/​ntp restart
 +[ ok ] Stopping NTP server: ntpd.
 +[ ok ] Starting NTP server: ntpd.
 +</​code>​
 +
 +Pentru a lista toate serverele NTP folosite, vom utiliza comanda ''​ntpq'':<​code bash>
 +root@gateway:​~#​ ntpq -p
 +     ​remote ​          ​refid ​     st t when poll reach   ​delay ​  ​offset ​ jitter
 +==============================================================================
 +*192.168.1.4 ​    ​89.36.18.21 ​     3 u   ​50 ​  ​64 ​   1    0.373    5.896   0.081
 +</​code>​
 +
 +
 +Pentru a configura ruterul ''​R1''​ să aibă rol de client NTP, vom specifica adresa serverului în modul global de configurare:​
 +<​code>​
 +R1>​enable
 +Password:
 +R1#conf t
 +R1(config)# ntp server 192.168.1.4
 +</​code>​
 +
 +Verificarea funcționării protocolului se realizează prin comenzi de tip ''​show'':​
 +<​code>​
 +R1#show clock
 +.12:​57:​55.421 UTC Sun Mar 9 2014
 +</​code>​
 +
 +<​code>​
 +R1#show ntp status
 +Clock is synchronized,​ stratum 3, reference is 192.168.1.4
 +nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**18
 +reference time is D6C6EF40.C43D8165 (13:​46:​40.766 UTC Sun Mar 9 2014)
 +clock offset is 14.9852 msec, root delay is 20.75 msec
 +root dispersion is 642.38 msec, peer dispersion is 414.18 msec
 +</​code>​
 +
 +<​code>​
 +R1#show ntp associations
 +      address ​        ref clock     ​st ​ when  poll reach  delay  offset ​   disp
 +*~192.168.1.4 ​     80.96.120.253 ​    ​2 ​   11   ​128 ​ 137    12.1   ​14.99 ​  414.2
 + * master (synced), # master (unsynced), + selected, - candidate, ~ configured
 +</​code>​
 +
 +Configurați pe ruterul ''​R2''​ ca server de NTP stația ''​monitor''​.
 +<​solution -hidden>
 +<code bash>
 +R2>​enable
 +Password:
 +R2#conf t
 +R2(config)# ntp server 192.168.1.4
 +R2(config)#​do sh ntp as
 +
 +      address ​        ref clock     ​st ​ when  poll reach  delay  offset ​   disp
 +*~192.168.1.4 ​     80.96.120.253 ​    ​2 ​    ​0 ​  ​128 ​  ​37 ​    ​3.8 ​ -14.60 ​  878.6
 + * master (synced), # master (unsynced), + selected, - candidate, ~ configured
 +</​code>​
 +</​solution>​
saisp/labs/03/contents/01.1394366685.txt.gz · Last modified: 2014/03/09 14:04 by mihai.carabas
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0