NTP protocol

root

Leader IT/Architect
Dec 31, 2012
1,153
72
48
1. Overview NTP
- NTP (Network Time ProtocolGiao version 3 - RFC 1305) cho phép các IP host đồng bộ thời gian của hệ thống từ một nguồn đồng hồ thời gian.

- Ví dụ: router và switch có thể đồng bộ đồng hồ thời gian của nó để các sự kiện diễn ra trong hệ thống đầy đủ ý nghĩa hơn do có các nhãn thời gian chính xác.
- Theo thiết kế
  • phần lớn router và switch dùng chế độ NTP client
  • Việc điều chỉnh đồng hồ của nó dựa trên thời gian được cung cấp bởi một NTP server.
- NTP định nghĩa các thông điệp này giữa client và server và thuật toán một máy client dùng để điều chỉnh đồng hồ của nó.
- Các routers và switch có thể được cấu hình như NTP server hoặc trong chế độ NTP symmetric active mode – là chế độ trong đó router hoặc switch sẽ đồng bộ hóa với nhau.

- Các NTP server có thể tham khảo các NTP server khác để có một nguồn đồng hồ chính xác hơn. Mức độ chính xác đuợc chỉ ra bởi mức stratum.
- NTP sử dụng kiến trúc phân cấp, phân lớp cho các cấp nguồn đồng bộ, mỗi một cấp trong phân cấp này được gọi là môt "stratum' và được gán một số của cấp bắt đầu từ 0 là cấp cao nhất.

- Ví dụ đồng hồ nguyên tử và các hệ thống định vị toàn cầu GPS có mức stratum 1 (thấp nhất/ tốt nhất có thể). Đối với một mạng doanh nghiệp, các router và các switch có thể tìm đến các nguồn NTP trên Internet hoặc dùng các NTP server phần cứng, có tích hợp GPS.

II. Các thành phần của NTP
1. NTP broadcast client mode:
- Router được cấu hình để lắng nghe thụ động các NTP broadcasts
Code:
ntp_client(config)#int ethernet 0
ntp_client(config-if)#ntp broadcast client

- Show cấu hình
ntp_clent#show ntp associations

address ref cloc8k st when poll reach delay offset disp
* 206.191.241.44 12.194.103.14 5 7 8192 76 4.1 0.05 910.5
* master (synced), # master (unsynced), + selected, - candidate, ~ configured

ntp_clent#show ntp status

Clock is synchronized, stratum 6, reference is 206.191.241.44
nominal freq is 250.0000 Hz, actual freq is 250.0093 Hz, precision is 2**19
reference time is BCF2162C.BDF0EE87 (09:33:16.741 CSTDST Wed Jun 14 2000)
clock offset is -91.9576 msec, root delay is 4.14 msec
root dispersion is 135.64 msec, peer dispersion is 43.67 msec




2. NTP static client mode:

- Router được cấu hình để lắng nghe từ 1 NTP tĩnh mà nó cấu hình và trao đổi các thông điệp giữa nó và NTP tĩnh đó
- config
Code:
hostname ntp_client
!  
[I]clock timezone CST -6[/I]
!
<<<text omitted>>>
!
interface Ethernet0
ip address 206.191.241.43 255.255.255.248
no ip directed-broadcast        [I]
ntp broadcast client[/I]
!
<<<text omitted>>>
!
  [I]ntp clock-period 17179279


This is added by the router[/I]

- show
ntp_client#show ntp stat

Clock is synchronized, stratum 6, reference is 206.191.241.44
nominal freq is 250.0000 Hz, actual freq is 250.0096 Hz, precision is 2**19
reference time is BCF258FA.69DAF6F5 (14:18:18.413 CSTDST Wed Jun 14 2000)
clock offset is -16.8153 msec, root delay is 4.06 msec
root dispersion is 409.61 msec, peer dispersion is 392.78 msec

ntp_client#
ntp_client#show ntp ass

address ref clock st when poll reach delay offset disp
~128.249.1.1 0.0.0.0 16 - 64 0 0.0 0.00 16000.
U2190.gif
NTP configured but no synced
* 206.191.241.44 128.194.103.14 5 46 8192 77 4.1 -16.82 392.8
* master (synced), # master (unsynced), + selected, - candidate, ~ configured
ntp_client#


ntp_client#show ntp ass

address ref clock st when poll reach delay offset disp
*~128.249.1.1 139.78.160.41 3 11 512 377 114.5 30.71 26.0
U2190.gif
NTP Sync
206.191.241.44 128.194.103.14 5 26 8192 77 4.1 15.23 20.0
* master (synced), # master (unsynced), + selected, - candidate, ~ configured


ntp_client#show ntp stat

Clock is synchronized, stratum 4, reference is 128.249.1.1
nominal freq is 250.0000 Hz, actual freq is 250.0093 Hz, precision is 2**19
reference time is BCF26309.F694401F (15:01:13.963 CSTDST Wed Jun 14 2000)
clock offset is 30.7128 msec, root delay is 151.06 msec
root dispersion is 97.17 msec, peer dispersion is 26.05 msec

ntp_client#




3. NTP master mode:

- Router được cấu hình như 1 NTP server thực hiện forwarding các gói NTP broadcast
- Cấu hình trên server:
Code:
ntp_server(config)#ntp master 7
- cấu hình trên Client
Code:
ntp_client(config)#ntp server 10.150.10.3
- Show cấu hình
ntp_client#show ntp status
Clock is synchronized, stratum 8, reference is 10.150.10.3
nominal freq is 250.0000 Hz, actual freq is 250.0000 Hz, precision is 2**19
reference time is BD13BB90.AE4D80D0 (03:03:44.680 UTC Mon Jul 10 2000)
clock offset is 1.2757 msec, root delay is 3.78 msec
root dispersion is 1.97 msec, peer dispersion is 0.67 msec
ntp_client#
ntp_client#show ntp associations

address ref clock st when poll reach delay offset disp
*~10.150.10.3 127.127.7.1 7 60 64 377 3.8 1.28 0.7
* master (synced), # master (unsynced), + selected, - candidate, ~ configured
ntp_client#

4. NTP peer associations:

- Các Router được cấu hình NTP ngang hàng nhau. Chúng có thể synchronize với các Router khác và ngược lại nó cũng cho các Router khác synchronize với nó
- Cấu hình trên Access Router

Code:
Access Router(config)#ntp peer 10.150.10.1

- Cấu hình trên Distribute Router

Code:
Distribution router(config)#ntp peer 10.150.10.3

- Cấu hình trên Core Router

Code:
Core Router(config)#ntp server 10.150.10.10

or

Code:
Core Router(config)#ntp master 6



5. NTP options and time-related configurations:

- cấu hình Authentication

  • Trên NTP Master
Code:
ntp_t_server(config)#ntp master 6
ntp_t_server (config)#ntp authenticate
ntp_t_server (config)#ntp authentication-key 3 md5 cisco
ntp_t_server (config)#ntp trusted-key 3

  • Trên NTP client
Code:
ntp_t_client(config)#ntp server 10.150.10.3
ntp_t_client(config)#ntp authenticate
ntp_t_client(config)#ntp authentication-key 3 md5 cisco
ntp_t_client(config)#ntp trusted-key 3


- Show cấu hình
tp_t_client#show ntp stat

Clock is synchronized, stratum 7, reference is 10.150.10.3
nominal freq is 250.0000 Hz, actual freq is 249.9990 Hz, precision is 2**19
reference time is BD15D137.C52F08AF (17:00:39.770 UTC Tue Jul 11 2000)
clock offset is 1.4114 msec, root delay is 3.77 msec
root dispersion is 1.46 msec, peer dispersion is 0.03 msec


ntp_t_client#show ntp associations

address ref clock st when poll reach delay offset disp
*~10.150.10.3 127.127.7.1 6 37 64 377 3.8 1.41 0.0
* master (synced), # master (unsynced), + selected, - candidate, ~ configured

ntp_t_client#

- Cấu hình Configure Clock and Time Zones

  • Liên quan đến các option như thiết lập thời gian(ngày, giờ...) và các thiết lập về authentication giữa các NTP
  • Trước khi thiết lập NTP master các bạn cần điều chỉnh clock set cho Router chính xác. Trước khi đồng bộ
Code:
R1#clock set 10:00:00 18 June 2014
R1(config)#clock timezone GMT +7
  • Để xem lại thời gian trên Router bạn các bạn dùng lệnh sau
R1#sh clock

10:00:20.247 GMT Wed Jun 18 2014

Nguồn: http://www.informit.com/library/content.aspx?b=CCIE_Practical_Studies_I&seqNum=194
 
Last edited:

About us

  • Securityzone.vn là một trang web chuyên về an ninh mạng và công nghệ thông tin. Trang web này cung cấp các bài viết, tin tức, video, diễn đàn và các dịch vụ liên quan đến lĩnh vực này. Securityzone.vn là một trong những cộng đồng IT lớn và uy tín tại Việt Nam, thu hút nhiều người quan tâm và tham gia. Securityzone.vn cũng là nơi để các chuyên gia, nhà nghiên cứu, sinh viên và người yêu thích an ninh mạng có thể trao đổi, học hỏi và chia sẻ kiến thức, kinh nghiệm và giải pháp về các vấn đề bảo mật trong thời đại số.

Quick Navigation

User Menu