3

I try to setup automatic syncing time on Cisco Catalyst 2960-CG-8TC-L switch using following command.

ntp server 0.cz.pool.ntp.org

and it works and sync time but after switch reload it does not sync time. In netflow collector I see that switch do not produce any NTP request to the NTP server and only way to force switch manually sync time is to run following commands again after each reboot manually.

no ntp server 0.cz.pool.ntp.org
ntp server 0.cz.pool.ntp.org

I think the cause is that switch tries to resolve "0.cz.pool.ntp.org" using DNS in time when ports are disabled and no communication with DNS server can occur. It prints over console follwoing message, stucks for aproximaltelly 10 seconds and then continues with initialization of interfaces, VLANS, SSH and so on.

Translating "0.cz.pool.ntp.org"...domain server (255.255.255.255)

command sh ntp status prints after reboot the following

Clock is unsynchronized, stratum 16, no reference clock
nominal freq is 190.7348 Hz, actual freq is 190.7348 Hz, precision is 2**20
ntp uptime is 22800 (1/100 of seconds), resolution is 5263
reference time is 00000000.00000000 (00:00:00.000 UTC Mon Jan 1 1900)
clock offset is 0.0000 msec, root delay is 0.00 msec
root dispersion is 3.25 msec, peer dispersion is 0.00 msec
loopfilter state is 'FSET' (Drift set from file), drift is 0.000000000 s/s
system poll interval is 8, never updated.

Is there any way how solve this issue and make switch syncing time after reboot?

4
  • 1
    Well, there's always the "dirty" way by scheduling a "no ntp / ntp" through kron.
    – JFL
    Jun 7 '20 at 9:54
  • 1
    You could also pick another ntp server and use its address instead of hostname
    – Ron Trunk
    Jun 7 '20 at 15:25
  • 1
    You can actually list multiple NTP servers. Also, you really should not use DNS names for this type of thing. You can also use a device in your network, e.g. WAN router, to be both an NTP client to the Internet, and an NTP server to your own network.
    – Ron Maupin
    Jun 7 '20 at 16:25
  • 1
    Anyway I would open a support case at Cisco, even if it cannot resolve the name at startup it should kick in after that.
    – JFL
    Jun 7 '20 at 18:22
4

You are correct. This is a DNS resolution issue.

The ntp process internally uses addresses, not names. So, although you can enter a name, and the system may store the name in the configuration, the process needs an address. The name cannot be resolved during boot -- not at the point the ntp configuration is processed.

So, you will either need to configure ntp with an address, or re-enter the named configuration after each reboot.

Note: Older versions will resolve the name on entry and store the resulting address in the configuration. Other ntp implementations support a newer "pool" type that periodically re-resolves the given name to find new/changed peers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.