Skip to end of metadata
Go to start of metadata

Running a NTP server on SmartOS

Background Information

I recently migrated my gateway to run ontop of SmartOS (OpenBSD in KVM zone), I used to feed it my serial GPS to get a better fix. This won't work with KVM.

So I decided to remove the GPS at first. That also did not work too great, I noticed a lot of drift! Mostly due to the kvm clock not updating the actual hardware clock!

My solution was to run ntpd inside a base zone. I had to give it some extra privilages, I also had to disable ntp in the global zone. In the end I even got my GPS to work, although not as wel as on OpenBSD.

Disabling NTP in the global zone

To disable ntp in the global zone I added a custom SMF. You'll see some commented lines to get my GPS to work too.
If you also want to use a GPS in the zone, uncomment those lines.

/opt/custom/smf/time-helper.xml
/opt/custom/bin/time-helper

Creating The Zone

The limit_priv line is important, it allows for: higher resolution timers to be used, ntpd to change it's niceness, ntpd to change the hw clock.

If you want to use a gps device you need to include it in the zone, there is no way to do this through vmadm

Run zonecfg -z UUID and add the following:

Configuring NTPD

/etc/inet/ntp.conf

Comment out 'local gps direct' when using a gps device

The last step is to get ntpd to run inside the zone, I hacked up the global zone's ntp smf manifest.

/srv/ntpd/smf/ntp.xml
/srv/ntpd/smf/svc-ntp
Labels:
ntp ntp Delete
unsupported unsupported Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.