NTP (Network Time Protocol)

Moderator: cah

Post Reply
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

NTP (Network Time Protocol)

Post by cah »

Code: Select all

gzcat ntp-4.2.4p5.tar.gz | tar xf
cd ntp-4.2.4p5
configure
make
make install

Code: Select all

vi /etc/ntp.conf
# $NetBSD: ntp.conf,v 1.9 2007/02/10 19:36:56 reed Exp $
#
# NetBSD default Network Time Protocol (NTP) configuration file for ntpd

# This file is intended to be both a usable default, and a Quick-Start
# Guide. The directives and options listed here are not at all complete.
# A great deal of additional documentation, including links to FAQS and
# other guides, may be found on the official NTP web site, in particular
#
# http://www.ntp.org/documentation.html
#

# Process ID file, so that the daemon can be signalled from scripts

pidfile /var/run/ntpd.pid

# The correction calculated by ntpd(8) for the local system clock's
# drift is stored here.

driftfile /var/db/ntp.drift

# Suppress the syslog(3) message for each peer synchronization change.

logconfig -syncstatus

# This will help minimize disruptions due to network congestion. Don't
# do this if you configure only one server!

tos minsane 2

# Hereafter should be "server" or "peer" statements to configure other
# hosts to exchange NTP packets with. Peers should be selected in such
# a way that the network path to them is symmetric (that is, the series
# of links and routers used to get to the peer is the same one that the
# peer uses to get back. NTP assumes such symmetry in its network delay
# calculation. NTP will apply an incorrect adjustment to timestamps
# received from the peer if the path is not symmetric. This can result
# in clock skew (your system clock being maintained consistently wrong
# by a certain amount).
#
# The best way to select symmetric peers is to make sure that the
# network path to them is as short as possible (this reduces the chance
# that there is more than one network path between you and your peer).
# You can measure these distances with the traceroute(8) program. The
# best place to start looking for NTP peers for your system is within
# your own network, or at your Internet Service Provider (ISP).
#
# Ideally, you should select at least three other systems to talk NTP
# with, for an "what I tell you three times is true" effect.
#

#peer an.ntp.peer.goes.here
#server an.ntp.server.goes.here

# Public servers from the pool.ntp.org project. Volunteer's servers
# are dynamically assigned to the CNAMES below via DNS round-robin.
# The pool.ntp.org project needs more volunteers! The only criteria to
# join are a nailed-up connection and a static IP address. For details,
# see the web page:
#
# http://www.pool.ntp.org/
#

# The country codes can help you find servers that are net-wise close.
# As explained above, closer is better...

# Northern U.S.A
#server ca.pool.ntp.org
#server us.pool.ntp.org
#server us.pool.ntp.org

# Northern Europe
#server de.pool.ntp.org
#server de.pool.ntp.org
#server dk.pool.ntp.org

# Depending on the vagaries of DNS can occasionally pull in the same
# server twice. The following CNAMES are guaranteed to be disjoint, at
# least over some short interval.

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

Code: Select all

vi /etc/init.d/ntp
#!/bin/sh

case "$1" in
'start')
/usr/local/bin/ntpd
;;
'stop')
pkill ntpd
;;

*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0

Code: Select all

chmod 744 /etc/init.d/ntp
cd /etc/rc2.d
ln -s ../init.d/ntp S74ntpd
Starting ntp:

Code: Select all

/etc/init.d/ntp start
Stoppng ntp:

Code: Select all

/etc/init.d/ntp stop
Ignore sanity limit check:

Code: Select all

ntpd -g
Manually force synchronization:

Code: Select all

ntpd -q
CAH, The Great
cah
General of the Army / Fleet Admiral / General of the Air Force
General of the Army / Fleet Admiral / General of the Air Force
Posts: 1342
Joined: Sun Aug 17, 2008 5:05 am

NTP (Network Time Protocol) - 4.2.6p5

Post by cah »

I was trying to compile and install 4.2.4p5 on Solaris 11.
It compiled and installed fine but couldn't run.

I then downloaded 4.2.6p5 from http://www.ntp.org/downloads.html.
I configured, compiled and installed fine.

A simple script "/usr/local/bin/ntpd" started ntp fine since I already have /etc/ntpd.conf in place.

Don't know why the older version of NTP failed. Well, the errors actually appeared in /var/adm/messages:

Code: Select all

Apr  4 15:39:59 cahtoh02 ntpd[15693]: [ID 702911 daemon.notice] ntpd 4.2.4p5@1.1541-o Wed Apr  4 13:35:55 PDT 2012 (3)
Apr  4 15:40:02 cahtoh02 ntpd[15693]: [ID 702911 daemon.error] Unable to register mDNS
Apr  4 15:40:02 cahtoh02 ntpd[15695]: [ID 702911 daemon.error] init_socket_sig: ioctl(I_SETSIG, S_INPUT) failed: Invalid argument
I went to comment out mDNS part in ntpd/ntpd.c but couldn't determine where to comment in libntp/iosignal.c so I decided to download the latest stable version to try. Luckily, the newer version works!
CAH, The Great
Post Reply