After installing Contrail 2.x, command contrail-status shows certain daemons in “initializing” state with the message “NTP state unsynchronized”. This article explains the issue and describes how to directly modify the /etc/ntp.conf file of all servers to configure a valid NTP server.
contrail-status
/etc/ntp.conf
A snippet of contrail-status showing the problem :
== Contrail Analytics == supervisor-analytics: active contrail-analytics-api active contrail-analytics-nodemgr initializing (NTP state unsynchronized.) contrail-collector active contrail-query-engine active contrail-snmp-collector active contrail-topology active == Contrail Config == supervisor-config: active contrail-api:0 active contrail-config-nodemgr initializing (NTP state unsynchronized.) contrail-device-manager active contrail-discovery:0 active contrail-schema active contrail-svc-monitor active ifmap active
During Contrail installation, it is necessary to configure a reachable NTP server in the testbed.py file. The installation scripts then configure this in / etc/ntp.conf after installation.
testbed.py
etc/ntp.conf
This is the section in testbed.py that should have the NTP server configured :
#ntp server the servers should point to env.ntp_server = 'ntp.juniper.net'
If this step is skipped during installation, it is still possible to fix this problem by directly modifying the /etc/ntp.conf of all servers to have a valid NTP server configured. Open the file /etc/ntp.conf in a vi editor and add the ntp server just below the following commented line :
# Specify one or more NTP servers. server ntp.juniper.net
Reboot the contrail nodes on which the above changes are made. It will take awhile for the servers to be NTP-synchronized.
Use the following command on the server to see if the server is NTP-synchronized. Contrail runs the ntpq command to check the NTP status.
ntpq
ntpq -n -c pe | grep ^*
If you see an output with “*” at the beginning of the line, it means the Contrail server is synchronized successfully to a NTP server. For example,
root@jnpr:~# ntpq -n -c pe | grep ^* *10.204.74.1 LOCAL(0) 4 u 334 1024 377 0.248 -0.006 0.053
If the command returns nothing, it means that NTP is unsynchronized. If you have configured the NTP server and still see the problem despite following the above guidelines, check the firewalls in between. Many of them, by default do not allow NTP traffic to pass by.