Skip to content

NTP support for management VRF #3400

Closed
kannankvs wants to merge 2 commits intosonic-net:masterfrom
kannankvs:mvrf_ntp2
Closed

NTP support for management VRF #3400
kannankvs wants to merge 2 commits intosonic-net:masterfrom
kannankvs:mvrf_ntp2

Conversation

@kannankvs
Copy link
Collaborator

@kannankvs kannankvs commented Aug 30, 2019

Support for NTP to run in management VRF is added.
As part of l3mdev based management VRF implementation, in order to execute the NTP daemon in the context of management vrf using cgexec, the NTP script /etc/init.d/ntp is updated to check for mvrf enabled status and call "start-stop-daemon" using cgexec. Since this /etc/init.d/ntp script is installed as part of NTP application (apt-get), a new script is used to update the installed /etc/init.d/ntp.
In addition, the linux NTP commands (programs) like “ntpq” and “ntpstat” require a loopback interface to connect to the ntpd and hence a dummy loopback interface lo-m is created in interfaces.j2 as part of management vrf.

TESTING:
Verified NTP using “ntpq -p” and “ntpstat” before enabling management VRF.
Enabled management vrf using “config vrf add mgmt” command that is explained in PR sonic-net/sonic-utilities#463
Verified NTP in management VRF using “cgexec” as follows.
root@sonic:/home/admin# date
Fri Aug 30 15:31:53 UTC 2019
root@sonic:/home/admin# cgexec -g l3mdev:mgmt ntpq -p
remote refid st t when poll reach delay offset jitter

23.92.29.245 .STEP. 16 u - 64 0 0.000 0.000 0.000
*204.2.134.164 44.24.199.34 3 u 9 64 1 200.601 -0.199 2.589

root@sonic:/home/admin# cgexec -g l3mdev:mgmt ntpstat
synchronised to NTP server (204.2.134.164) at stratum 4
time correct to within 1085 ms
polling server every 64 s
root@sonic:/home/admin# ps -ax | grep ntp
9761 ? Ssl 0:00 /usr/sbin/ntpd -p /var/run/ntpd.pid -g -u 106:110
9799 ttyS1 S+ 0:00 grep ntp
root@sonic:/home/admin#

@kannankvs
Copy link
Collaborator Author

@lguohan : Request you to kindly close the previous PR #3204. W.r.t the comment on that PR about complexity in using SED for the file mgmtvrf_add_cgexec_to_ntp.sh, we have provided our comments/replies. Request you to provide your feedback.

@kannankvs
Copy link
Collaborator Author

We had issues in updating the already existing PR #3204 . That is why we created this new PR #3400 . Later, we resolve the issue in updating the existing PR #3204 and hence we are closing this duplicate PR #3400. This way, the original comments given in PR #3204 stays as is.
@lguohan : requesting you to continue your review on PR #3204 and provide your comments.
Our apologies for the confusion.

@kannankvs kannankvs closed this Sep 3, 2019
yxieca pushed a commit that referenced this pull request Mar 28, 2025
This replaces ntpd with Chrony, as described in sonic-net/SONiC#1852. The advantages of this (among others) is control over enabling/disabling long jumps/steps and guaranteed updates of the real time clock.

This PR also includes a submodule update of sonic-utilities, to bring in necessary changes there for chrony to work. The changelog for sonic-utilities is:

Submodule src/sonic-utilities ce51df2..7cbb2f2:
  > [sfputil] add support for sfputil debug tx-output/rx-output {port} enable/disable  (#3811)
  > Switch to using chrony instead of ntpd (#3574)
  > Added post commands for enabling fifos (#3801)
  > kdump-Remote-SSH-Configurations (#3400)

Signed-off-by: Saikrishna Arcot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant