Basic IOS NTP Configuration
Posted on 28th June 2011It was encountered earlier, but I never checked it, or you can say, I never cared!
I am following IPExpert’s Online Study List for my CCIE Voice preparation. Due to daily power cut problems of several hours, I am a bit contracted to reading the mail and Work Books. Thinking of starting it very soon.
While going through one of the mails, I encountered NTP stratum and preference discussed. Interested!
Set up my lab in GNS to have three routers as per the figure below:
I configured the NTP master routers as below:
R1 Configuration
!
clock timezone NPT 5 45 ! Set the timezone to Nepal Standard Time
!
! output omitted for brevity
!
interface Loopback0
ip address 1.1.1.1 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.1 255.255.255.0
!
!
router eigrp 100
network 1.1.1.1 0.0.0.0
network 192.168.12.0
no auto-summary
!
! output omitted for brevity
!
ntp master 10 ! Set the stratum of this NTP server to 10
R3 Configuration
!
clock timezone NPT 5 45
!
! output omitted for brevity
!
interface Loopback0
ip address 1.1.1.3 255.255.255.255
!
interface FastEthernet0/1
ip address 192.168.23.3 255.255.255.0
!
router eigrp 100
network 1.1.1.3 0.0.0.0
network 192.168.23.0
no auto-summary
!
! output omitted for brevity
!
ntp master 5
Then, I configured the client router, that is, the central router R2 as follows:
R2 Configuration
!
! output omitted for brevity
!
interface Loopback0
ip address 1.1.1.2 255.255.255.255
!
interface FastEthernet0/0
ip address 192.168.12.2 255.255.255.0
!
interface FastEthernet0/1
ip address 192.168.23.2 255.255.255.0
!
router eigrp 100
network 1.1.1.2 0.0.0.0
network 192.168.12.0
network 192.168.23.0
no auto-summary
!
! output omitted for brevity
!
ntp server 1.1.1.1 prefer
The output of show ntp association and show ntp status displayed as expected for this:
r2(config)#do sh ntp assaddress ref clock st when poll reach delay offset disp
*~1.1.1.1 127.127.7.1 10 0 64 17 52.2 -61.42 1903.8
* master (synced), # master (unsynced), + selected, – candidate, ~ configured
r2(config)#
r2(config)#do sh ntp stat
Clock is synchronized, stratum 11, reference is 1.1.1.1
nominal freq is 250.0000 Hz, actual freq is 249.9991 Hz, precision is 2**18
reference time is D1B482DB.33C67EE4 (16:42:03.202 UTC Tue Jun 28 2011)
clock offset is -53.8983 msec, root delay is 48.22 msec
root dispersion is 105.96 msec, peer dispersion is 52.02 msec
r2(config)#
After a few seconds as soon as I used second ntp server, with lower stratum (of 5), I found that the second – and not preferred – NTP server is used.
r2(config)#ntp server 1.1.1.3
r2(config)#do sh ntp assaddress ref clock st when poll reach delay offset disp
*~1.1.1.1 127.127.7.1 10 5 64 377 48.2 -53.90 47.7
~1.1.1.3 0.0.0.0 16 – 64 0 0.0 0.00 16000.
* master (synced), # master (unsynced), + selected, – candidate, ~ configured
r2(config)#do sh ntp stat
Clock is synchronized, stratum 11, reference is 1.1.1.1
nominal freq is 250.0000 Hz, actual freq is 249.9993 Hz, precision is 2**18
reference time is D1B4831B.31A5FC4F (16:43:07.193 UTC Tue Jun 28 2011)
clock offset is -53.8983 msec, root delay is 48.22 msec
root dispersion is 101.64 msec, peer dispersion is 47.70 msec
r2(config)#do sh ntp assaddress ref clock st when poll reach delay offset disp
~1.1.1.1 127.127.7.1 10 44 64 377 48.2 -53.90 47.7
*~1.1.1.3 127.127.7.1 5 18 64 377 7.9 170038 17.8
* master (synced), # master (unsynced), + selected, – candidate, ~ configured
r2(config)#so sh ntp sta
Clock is synchronized, stratum 6, reference is 1.1.1.3
nominal freq is 250.0000 Hz, actual freq is 249.9993 Hz, precision is 2**18
reference time is D1B48335.280423C5 (16:43:33.156 UTC Tue Jun 28 2011)
clock offset is 170038.5977 msec, root delay is 7.92 msec
root dispersion is 170056.38 msec, peer dispersion is 17.76 msec
r2(config)#
So what I knew from this memorable lab is that even if there is a high stratum preferred NTP server is there, a lower stratum NTP server gets preference. This is a GNS lab scenario; have to check on real lab.
One thing I’ve noticed is that the show ntp status displays n+1 stratum while show ntp association displays the exact n configured stratum.
