3

I have a Cisco 877W which I'm using for my home ADSL connection (and as a refresher in Cisco IOS). I've got a working config in-place with my PPPoA connection coming online correctly, and VLANs and other settings configured as I want them, but I can't crack the NTP configuration.

For NTP, I have the following defined

ntp server 0.uk.pool.ntp.org source Dialer0
ntp server 1.uk.pool.ntp.org source Dialer0
ntp server 2.uk.pool.ntp.org source Dialer0
ntp server 3.uk.pool.ntp.org source Dialer0

This setup works fine when issued in Global Configuration Mode when the Dialer0 interface (ATM0.1) is up. The configuration fails at startup though:

Translating "1.uk.pool.ntp.org"...domain server (208.67.222.222) (208.67.220.220)

ntp server 1.uk.pool.ntp.org source Dialer0
                                            ^
% Invalid input detected at "^" marker.

This is repeated for the other servers defined.

Obviously the DNS lookup for the server(s) fails because the DNS servers cannot be accessed because the external interface is not yet online.

Is there a way to delay the NTP configuration until afte the Dialer0 interface is fully initialised? Can the NTP commands be triggered by the Line Protocol on the Dialer0 interface transitioning to the up state? Alternatively, can the NTP commands be delayed for 5 minutes after the router has finished initialising?

Any advice, or pointers to useful documentation or examples gratefully received ...

Mike Insch
  • 1,254
  • 8
  • 10

3 Answers3

2

OK, I think I might have solved this - though my head hurts now! Posting for others who might encounter this ...

I've removed my NTP server setup from the config and substituted the following:

kron policy-list ntp
 cli ntp server 0.uk.pool.ntp.org source Dialer0
 cli ntp server 1.uk.pool.ntp.org source Dialer0
 cli ntp server 2.uk.pool.ntp.org source Dialer0
 cli ntp server 3.uk.pool.ntp.org source Dialer0

kron occurrence ntp-init in 5 oneshot
 policy-list ntp

Now, after a reload the router waits 5 minutes before configuring NTP, which seems to work OK so far ... It's a bit of a hack though - there's probably a better way !

Mike Insch
  • 1,254
  • 8
  • 10
  • The problem with this approach is that after the 5 minute delay has passed, two things happen: 1. the `kron occurrence ...` command is removed from `running-config`, and the individual `ntp server X.uk.pool.ntp.org source Dialer0` commands are present in `running-config`. To be effective, every future config change also requires that the `kron occurrence ...` command is re-entered, and that `no ntp server X ...` is entered for each server before doing `copy running-config startup-config` - so this is only useful as a workaround, it's not a true solution. – Mike Insch Jul 15 '11 at 13:20
1

on my 1841 (15.1(3)T) IOS will attempt to resolve the ntp server name at boot time before the interfaces are online, which obviously fails. I 'fixed' the issue by using ntp server address instead of host name.

  • This is the only workaround I have found so far myself. Pretty stupid of a mistake coming from Cisco. – gparent Nov 14 '12 at 16:49
0

The kron workaround didn't work for me, I think because kron can't run global config commands, but I was able to to this with an Embedded Event Manager (EEM) script instead:

event manager applet NTP_CONFIG
 event timer countdown name ON_BOOT time 180 maxrun 60
 action 100 cli command "enable"
 action 110 cli command "configure terminal"
 action 120 cli command "ntp server 0.us.pool.ntp.org"
 action 130 cli command "ntp server 1.us.pool.ntp.org"
 action 140 cli command "ntp server 2.us.pool.ntp.org"
 action 150 cli command "ntp server 3.us.pool.ntp.org"

While you still have to wait for the DNS look ups to timeout during boot and get removed, this will re-add them three minutes after the device boots. Tested on IOS 15.1(3)T2.

chaz
  • 1