Add to Google Reader or Homepage |
~ pjvenda / blog
$home . blog . photography

04 April 2007

NTP receives dynamic interface tracking

This is to all time keepers that happen to have the bad idea of reading my blog. I must admit I am a terrible blogger - I have about 5 partially written posts for about two months now and my posting average is dangerously close to one per month...

To the point:
The world famous NTP daemon gained an important feature for all internet users with dynamic IP assignments. "Dynamic interface tracking" is a simple feature (from the user's point of view) that makes the NTP daemon aware of IP changes on network interfaces to avoid loosing synchronisation.

Before this feature existed, upon startup, the NTP daemon would store all the IP addresses to which it would bind. While doing its job, the daemon used those stored IPs as source IPs to contact servers and peers. If one IP would change on a given network interface, all servers and peers contacted through that interface would become unreachable because the stored source IP no longer matched the new interface's IP. In the common case of a server with a DSL internet connection, all external servers and peers are reached through the PPP interface and if that IP changes (as it does frequently in my case) no more servers can be contacted resulting in loosing synchronisation.

Stable version 4.2.4p0 of the NTP implementation ( includes dynamic interface tracking and an important bugfix (#765) which allows using this feature while running the daemon with an unprivileged user. The first official version including dynamic interface tracking was 4.2.4.

This feature is activated automatically and the scanning intervals can be controlled with the daemon option "-U". In my case, instead of using "ntpd -u ntp:ntp -g" I now use "ntpd -u ntp:ntp -g -U 600" and I do not have to restart ntpd regularly because of frequent IP changes (every 17h55m).

[EDIT: forgot to mention the Gentoo overlay ebuild method]

There is not yet a Gentoo Linux ebuild for ntp 4.2.4p0 (although I offered one on Gentoo bugzilla), but it is easy to overlay one and try out the updated 4.2.4:

  1. add the following line into /etc/make.conf if there isn't one already

  2. create the new overlay for ntp 4.2.4p0
    # mkdir -p /usr/local/portage/net-misc/ntp
    # cp /usr/portage/net-misc/ntp/ntp-4.2.4-r1.ebuild /usr/local/portage/net-misc/ntp/ntp-4.2.4_p0.ebuild
    # cp -r /usr/portage/net-misc/ntp/files /usr/local/portage/net-misc/ntp/

  3. edit /usr/local/portage/net-misc/ntp/ntp-4.2.4_p0.ebuild and change:

  4. create digests for the new overlayed ebuild
    # ebuild /usr/local/portage/net-misc/ntp/ntp-4.2.4_p0.ebuild digest

  5. emerge the new ntp
    # emerge =net-misc/ntp-4.2.4_p0

  6. be aware that if you had ntp-4.2.4-r1 installed, the portage system will think you are downgrading ntp, so you need to pay attention when upgrading the system to prevent portage from "updating" ntp back to 4.2.4-r1
Cheers everyone,