Thursday, 19 November 2015

NTP


Lets make all our LAN's network-devices, PCs or SmartTV's time or clock or watches is same or synchronized and keep it same or synchronized until forever.
In essence, in your LAN, dedicates a/one device as a NTP master and other devices in your LAN as client NTP.

Your-LAN NTP master cling to outside/public/internet's NTP master and your-LAN client NTP cling into your-LAN NTP master. Thats it.

So, for our LAN first we define R1 as our dedicated NTP master that serve the rest of our LAN's devices as follows:
R1#config terminal
R1(config)# ntp server time.microsoft.com

You can choose your own preferred NTP server by the way. You can just google for it or you can obtain a list of publicly accessible NTP servers here: www.ntp.org.

As for now, you can see that R1 is commanded to use outside's/internet's time server as its time/ntp server that is: time.microsoft.com in our case. You need internet connection to be able to connect to time.microsoft.com server and off course your router need to have dns server address and also able to ping the name: time.microsoft.com. If you don't use dns server, you can directly type the NTP server's in IP address format. For instance:
R1(config)#ntp server 192.168.1.1
R1(config)#

So now lets check its time, as follows:

R1#show clock
07:53:57.922 UTC Thu Nov 19 2015

Thats still not correct! What we missing is 'setting up the timezone of our own', so now lets add below command:
R1(config)# clock timezone INDONESIA +7

and then show clock again, as follows:
R1#show clock
15:05:49.860 INDONES Thu Nov 19 2015

Now its match. Indeed it is 3 PM now.

Congratulations..

NTP can be used to setting the clock of Cisco devices. But, not just Cisco devices, your Windows or Linux devices can also use NTP to set up their clock.

You can use a command like: show ntp associations, but whats that good for you is just wether the router have been synchronized or not with the ntp outside. Like below:

R1#show ntp associations

  address         ref clock       st   when   poll reach  delay  offset   disp
*~104.209.134.106 129.6.15.30      2     38     64   377 269.45  17.997 18.285
+~103.31.248.249  203.160.128.3    3     29     64   377 51.373  39.953  2.909
 * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured

Right at the very bottom is  * sys.peer, # selected, + candidate, - outlyer, x falseticker, ~ configured.

R1#show ntp status
Clock is synchronized, stratum 3, reference is 104.209.134.10
nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**28
reference time is D9F80E87.6F85B6AD (16:01:59.435 INDONES Thu Nov 19 2015)
clock offset is 23.9173 msec, root delay is 300.02 msec
root dispersion is 115.20 msec, peer dispersion is 20.16 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000001037 s/s
system poll interval is 64, last update was 301 sec ago.

R1#show ntp status
Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 250.0000 Hz, actual freq is 249.9997 Hz, precision is 2**28
reference time is D9F80E87.6F85B6AD (16:01:59.435 INDONES Thu Nov 19 2015)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 0.50 msec, peer dispersion is 0.00 msec
loopfilter state is 'CTRL' (Normal Controlled Loop), drift is 0.000001037 s/s
system poll interval is 64, last update was 398 sec ago.
 

No comments:

Post a Comment