HOW TO INSTALL NTP ON FREEBSD
ASSUMPTIONS:
- You are familiar with computers, and probably
know either Windows or Linux fairly well.
- You have already installed FreeBSD. If not, then
click here:
How to Install FreeBSD
- You have configured the FreeBSD shell. If not, then
click here:
How to
Configure the FreeBSD Shell
- Your 'ports tree' is up to date. If you don't know,
then it probably isn't. Update the ports tree by
issuing one of these commands:
Update
the Ports Tree Using CVSup
- Here is how to configure your computer so that
CVSup
is run on a regular basis
NOTE WELL:
- In the NTP configuration file
/etc/ntp.conf, (as is true
with many Unix type files), a hash/pound sign '#', and a
semi-colon ';' at the beginning of a line means that the computer
should ignore the rest of the line. Typically, these
'ignore' characters are for your benefit--they usually
contain comments about what is taking place. Hence, when
a line begins with # or ; it is 'commented out'. Sometimes
double slashes '//' have the same 'ignore' effect--it just
depends on what type of program is reading the file.
WHAT IS NTP?
- NTP stands for Network Time Protocol. It is a set
of software programs that are used to keep accurate
time on computers. It accomplishes this by referring
to other time sources and then using some intelligent
algorithms and taking into consideration transmission delays,
and other factors arrives at very precise time keeping.
- There are all sorts of reasons for having accurate time
on computers--if you are reading this you probably have
your own. If you want to
find
out more about how NTP works, click here.
If you want to
find
out about the history of NTP, click here.
The purpose of this page, however, is to get it
installed and working quickly for you.
WHAT KIND OF HARDWARE?
- NTP works best on a computer that is not loaded
heavily. A heavily loaded file server, or any
other computer that has a heavy CPU load will
interfere with NTP's time-sensitive algorithms, and
make it more difficult to keep accurate time.
Ideally, a completely separate computer used
exclusively as a time server is best. Even
an old 486 computer will be able to maintain
excellent accuracy.
All other computers should be able to listen to
NTP broadcasts that the time server puts out with
minimal load on the CPU.
The procedure to do this is
listed below.
BEGIN INSTALLATION
- You can find NTP in the this directory:
/usr/ports/net/ntp
At the present time (2004 October) the current version
is 4.2.0. If your ports tree is current (see above),
you can find out what the current, stable version is
by doing the following:
cd /usr/ports/net/ntp/
more distinfo
From this you should see the file name of the current version.
You should see a file name like this:
ntp-4.2.0.tar.gz
- To begin the installation process, enter:
make install
- The computer will look for the file
and download it from an FTP server
if the file doesn't happen to be already in
/usr/ports/distfiles/.
- It will then go on showing lots of lines of messages
as it builds. It will also download any program or file
that it depends on.
- It is possible that the 'make install' process will
not complete successfully. If this happens, go
to:
'make install' fails on FreeBSD before returning here.
- After NTP has been installed, you should see something like this:
/bin/sh ../mkinstalldirs /usr/local/bin
Making install in clockstuff
Making install in kernel
Making install in sys
Making install in util
/bin/sh ../mkinstalldirs /usr/local/bin
Install -c -s -o root -g wheel -m 555 ntptime /usr/local/bin/ntptime
Install -c -s -o root -g wheel -m 555 tickadj /usr/local/bin/tickadj
Install -c -s -o root -g wheel -m 555 ntp-keygen /usr/local/bin/ntp-keygen
===> Registering installation for ntp-4.2.0_1
===> SECURITY REPORT:
This port has installed the following files which may act as
network
servers and may therefore pose a remote security risk to the
system.
/usr/local/bin/ntpdate
/usr/local/bin/ntpd
If there are vulnerabilities in these programs there may be a
security
risk to the system. FreeBSD makes no guarantee about the
security of
ports included in the Ports Collection. Please type 'make
deinstall'
to deinstall the port if this is a concern.
For more information, and contact details about the
security
status of this software, see the following webpage:
http://www.ntp.org/
Whether you see the above or not, in any case, you
shouldn't see any 'error code' messages if NTP
has installed successfully.
CHECK FOR BROADCASTCLIENT FIX
- As of this writing, (2004 October), there was a bug
in the broadcast client part of the software that
has been fixed, but hasn't made it into the software
'tarball' (compressed set of files). In order
to find out whether the fix has been included, enter
something similar to the following, based on your
version of the software:
cd /usr/ports/net/ntp/
cp -p /usr/ports/distfiles/ntp-4.2.0.tar.gz /usr/ports/net/ntp/
tar xvzf ntp-4.2.0.tar.gz
cd ntp-4.2.0
cd libisc
ls -lt
- You should see a file named
ifiter_ioctl.c.
If the date of that file is 2004 March or newer, then
you have the fix and can skip to the next section.
- If the date of that file is before 2004 March then we need to
replace it. First rename the existing file:
mv ifiter_ioctl.c
ifiter_ioctl.c.old
- Now download the following file:
http://www.US-Webmasters.com/Temp/ifiter_ioctl.c.txt
- Place this file in the same directory as the old
ifiter_ioctl.c.old
- Copy the file like this:
cp -p ifiter_ioctl.c.txt
ifiter_ioctl.c
RECOMPILE
- Change to the NTP directory:
cd /usr/ports/net/ntp/
- Change to directory of the current version.
Change
ntp-4.2.0 to whatever
is appropiate for your version:
cd ntp-4.2.0
- Configure, compile and install:
mkdir work
cd work
../configure
make install
- It will then go on showing lots of lines of messages
as it builds. It will also download any program or file
that it depends on. Most likely it will compile
within 5 minutes.
- It is possible that the 'make install' process will
not complete successfully. If this happens, go
to:
'make install' fails on FreeBSD before returning here.
- If it has compiled and installed, you will see a screen
similar to the one above that contains something similar
to:
Registering installation for ntp-4.2.0_1
In any case, if it has compiled successfully,
there should be an absence of 'error code'
messages.
- The version that we just compiled should
end up in the following directory. Go there
and take a look at the file dates to confirm this:
/usr/local/bin/
You might see a precompiled version of NTP here:
/usr/sbin/
Or if you do a custom compilation you might find
a version here:
/usr/local/sbin/
CHOOSING WHICH TIME SERVERS TO USE AS REFERENCES
- For NTP to work properly, it must have accurate sources
of time to refer to. Generally, the best source (outside
of having your own GPS or radio receiver) is a Stratum 1
time server. This link shows a list of Stratum 1 servers:
http://ntp.isc.org/bin/view/Servers/StratumOneTimeServers
Here are some other links:
http://ntp.isc.org/bin/view/Servers/StratumTwoTimeServers
http://www.eecis.udel.edu/~mills/ntp/clock1a.html
http://www.boulder.nist.gov/timefreq/service/time-servers.html
http://tycho.usno.navy.mil/ntp.html
http://www.ativapro.com/timeservers.htm
http://www.Google.com/search?q=NTP+time+servers+stratum+list
- It is important to note that just because these time
servers exist, it doesn't mean that it is proper for you to
use them. Each time server has 'rules of engagement' that
you need to adhere to. Unless a time server has an
'open access' policy, you need to contact the operator of
the time server.
- The best time servers to use as references are those that
are 'closest' to you on the Internet. Generally speaking,
'closest' will those that are geographically close to your
location. In order to find out which of the various time servers
are closest to you on the Internet, use the ping command:
ping -c 10 ntp0.SomeTimeServer.edu
For each of the time servers, take the 'avg'
figure for each ping listing, and create a list
with the servers with the shortest ping times on the
top of your list.
- After you have contacted the server operators and
gained permission to use these servers, or the server
is 'open access', put these servers on your final list.
You will need to include them in the
ntp.conf file
which we will describe next.
EDITING THE CONFIGURATION FILE: /etc/ntp.conf
- The file
ntp.conf
located in the /etc directory is
the configuration file that the NTP programs rely on for
operation. This file probably doesn't exist on
your computer right now, but to see if it does,
enter the following:
cd /etc
ls -lt n*.conf
- If it does exist, do a back up:
cp -p ntp.conf ntp.conf.1.bak
- If it doesn't, create it:
touch ntp.conf
- Now open it up with Pico and edit it:
pico ntp.conf
- Here is a sample
ntp.conf
file with fake timeservers:
# This is the configuration file for NTP
# (Network Time Protocol). More info at
# www.NTP.org
# This computer will act as a stratum 2 time
# server, by referencing the following 4 or
# more stratum 1 time servers:
server clock.wotsamata-u.edu
iburst # Wotsamata Univ, Somecity, ST
server time.militarybranch.gov
iburst # USNO, Gaithersburg, MD
server tick.ivyleaguecollege.edu
iburst # Uppity Univ., Cambridge, MA
server tock.somegovagency.org
iburst # NIST, Boulder, CO
server ntp2.colorado.edu
iburst # Univ. of Colo., Boulder, CO
# Since the clock on most PCs drifts around
# significantly, let's use a file to
# keep track of that drift and compensate
# for it:
driftfile /etc/ntp.drift
# This server will broadcast NTP timing signals
# over the Local Area Network (LAN)
broadcast 192.168.2.255
# Let's setup a log file for NTP:
logfile /var/log/ntp.log
Here is that file in a text format:
ntp.conf.txt
- Much of this file is self-explanatory. However, here
are some items to understand:
The server commmand tells NTP
that this is a server to be used as a reference.
Replace the fake server names with the names of
time servers from your list that you compiled.
You should have at least 3, but probably not more
than 5 server lines.
The iburst argument allows for
a quick synch-up when you reboot your time server.
Note that the 'hash' marks '#' on the
server lines
are comments about the geographic location
of the server. The NTP
program ignores them, but they are useful for
your future reference.
The broadcast
line indicates which IP address on
your internal Local Area Network that you want
the NTP signals directed towards. You will
need to consult your router manual to
determine this address.
- Once you have edited
ntp.conf,
save the file
and exit pico by:
Ctrl-O
Enter
Ctrl-X
CONFIGURING NTP TO START ON BOOT UP
- First, let's travel to the directory where the
startup file
rc.conf
exists:
cd /etc
ls -lt rc.c*
- Next, let's back it up:
cp -p rc.conf rc.conf.1.bak
ls -lt rc.c*
- Now fire up pico so we can edit it:
pico rc.conf
- Go down to the end of the file and add on
the following:
# Make sure that we don't use 'ntpdate'. It is obsolete.
ntpdate_enable="NO"
# NTP (Network Time Protocol) time-keeping program
# to set time on boot-up and adjust time while
# operating.
xntpd_enable="YES"
# The NTP program is located here:
xntpd_program="/usr/local/bin/ntpd"
# We want to run the NTP program with some options (flags).
#
# This is what they mean:
#
#
-A
= Disable authentication mode
#
#
-c /etc/ntp.conf
= The configuration file's location
#
#
-g
= Grab the correct time at startup
#
# -N
= Notable Priority. The OS should
#
give ntpd highest permitted
#
priority when scheduling tasks
#
#
-p /var/run/ntpd.pid
= The Process ID will be found here
#
#
-l /var/log/ntpd.log
= This where we will Log activities
#
#
Here's the command line:
#
xntpd_flags="-A
-g -N -c /etc/ntp.conf -p /var/run/ntpd.pid -l /var/log/ntpd.log"
(Note that the above 'xntpd_flags' line is all
on one line--even if your browser wraps it.)
Here are the above lines in text format:
rc.conf.ntp.txt
- Be absolutely certain that you have triple checked your
typing. If you leave off a quote mark, or similar typo,
when you reboot you could be in big trouble. If you
do, you may get an error message like:
Read only file system
If you do, you will need to carefully use the work around for
this problem:
How To Fix The 'Read Only File System' Problem When rc.conf is Corrupted on Freebsd
MANUALLY SYNCHRONIZE YOUR COMPUTER WITH AN
ACCURATE TIME SERVER
- Enter the following command:
/usr/local/bin/ntpdate tick.usno.navy.mil
REBOOT COMPUTER SO THAT NTP LOADS AND RUNS ON BOOT UP
- Reboot by entering the following:
shutdown -r +2
MONITOR NTP'S OPERATION USING DEBUGGING COMMANDS
- There are number of commands and tools that let
you monitor the operation of NTP. A few are
below. The new commands are located:
/usr/local/bin/
Here are the commands. You can find out more about
them by typing man nameofcommand
at a command prompt.
ntpdc -c kerninfo
ntpdc
ntpdc> monlist
ntpq
ntpq> pe
ntpq> rv
ntptime
ntptrace -v
ifconfig -a
- Information can also be garnered from the logs:
cd /var/log/
more ntp.log
more ntpd.log
- The driftfile shows how many parts per million
the computer's clock needs to be adjusted in order
to keep proper time:
cd /etc
more ntp.drift
- This completes the procedure for setting up a time
server running NTP. Since all computers don't need
to be running as a time server, the next section
describes how to set up a computer to listen to the
time 'broadcasts' on your Local Area Network.
HOW TO SETUP A FREEBSD COMPUTER TO LISTEN TO NTP
BROADCASTS AS A BROADCAST CLIENT
- Setting up a computer to listen to NTP
time broadcasts over the LAN is very similar
to setting up a computer as a time server--
just a bit more simplified.
- Follow the steps in the above sections called:
BEGIN INSTALLATION
CHECK FOR BROADCASTCLIENT FIX
RECOMPILE
- Skip the above section called:
CHOOSING WHICH TIME SERVERS TO USE AS REFERENCES
EDITING THE CONFIGURATION FILE: /etc/ntp.conf FOR BROADCAST CLIENTS
- The file
ntp.conf
located in the /etc directory is
the configuration file that the NTP programs rely on for
operation. This file probably doesn't exist on
your computer right now, but to see if it does,
enter the following:
cd /etc
ls -lt n*.conf
- If it does exist, do a back up:
cp -p ntp.conf ntp.conf.1.bak
- If it doesn't, create it:
touch ntp.conf
- Now open it up with Pico and edit it:
pico ntp.conf
- Here is a sample
ntp.conf
file for broadcast clients:
# This is the configuration file for NTP
# (Network Time Protocol). More info at
# www.NTP.org
# This computer will act as a passive
# NTP broadcast client
# Because the computer clock drifts,
# let's define a place to store
# this information:
driftfile /etc/ntp.drift
# This line shows that we are just
# a client that listens to NTP
# broadcasts on the LAN:
broadcastclient
# Let's setup a log file for NTP:
logfile /var/log/ntp.log
Here is that file in a text format:
ntp.conf.bcclient.txt
- Once you have edited
ntp.conf,
save the file
and exit pico by:
Ctrl-O
Enter
Ctrl-X
CONFIGURING NTP TO START ON BOOT UP--FOR BROADCAST CLIENTS
- First, let's travel to the directory where the
startup file
rc.conf
exists:
cd /etc
ls -lt rc.c*
- Next, let's back it up:
cp -p rc.conf rc.conf.1.bak
ls -lt rc.c*
- Now fire up pico so we can edit it:
pico rc.conf
- Go down to the end of the file and add on
the following:
# Make sure that we don't use 'ntpdate'. It is obsolete.
ntpdate_enable="NO"
# The NTP program is located here:
xntpd_program="/usr/local/bin/ntpd"
# NTP (Network Time Protocol) time-keeping program
# to set time on boot-up and adjust time while
# operating.
xntpd_enable="YES"
# We want to run the NTP program with some options (flags).
#
# This is what they mean:
#
#
-A
= Disable authentication mode
#
#
-c /etc/ntp.conf
= The configuration file's location
#
#
-N
= Notable priority. The OS should
#
give ntpd highest permitted
#
priority when scheduling tasks
#
#
-p /var/run/ntpd.pid
= The Process ID will be found here
#
# -l /var/log/ntpd.log
= This is where we will Log activities
#
# Here's the command line:
#
xntpd_flags="-A -N -c /etc/ntp.conf -p /var/run/ntpd.pid -l /var/log/ntpd.log"
(Note that the above 'xntpd_flags' line is all
on one line--even if your browser wraps it.)
Here are the above lines in text format:
rc.conf.bcclient.txt
- Be absolutely certain that you have triple checked your
typing. If you leave off a quote mark, or similar typo,
when you reboot you could be in big trouble. If you
do, you may get an error message like:
Read only file system
If you do, you will need to carefully use the work around for
this problem:
How To Fix The 'Read Only File System' Problem When rc.conf is Corrupted on Freebsd
- Follow the steps in the above sections called:
MANUALLY SYNCHRONIZE YOUR COMPUTER WITH AN ACCURATE TIME SERVER
REBOOT COMPUTER SO THAT NTP LOADS AND RUNS ON BOOT UP
MONITOR NTP'S OPERATION USING DEBUGGING COMMANDS
- That's it!
Here are some other FreeBSD related links:
How to Install FreeBSD
Shell Configuration
FreeBSD Device List
Hardware
Burn-In Test Using FreeBSD
FreeBSD
Commands Cheat Sheet
'make
install' fails on FreeBSD
The
FreeBSD 'Handbook' online
Search
for Answers to Questions about FreeBSD
How
to Install NTP (Network Time Protocol) software on FreeBSD
How
to Install Samba file server software on FreeBSD
Mounting
and Using the Floppy Drive in FreeBSD
Mounting
and Using the CD-ROM Drive in FreeBSD
How to Find or Search for a Directory or a file
How to Preserve the Date and Time Stamp When Copying Files
How to Copy Files, and Directories recursively in FreeBSD / unix
How To Fix The 'Read Only File System' Problem When rc.conf is Corrupted on Freebsd
Random Passwords Generator
URL Decoder / Link Maker
AT YOUR OWN RISK: These instructions have no guarantee or
warrantee of fitness for any purpose whatsoever--and none
shall be implied or inferred. If you use these
and incur any kind of damage--it is your responsibility.
How to Install NTP (Network Time Protocol) on FreeBSD. Time Server Software for millisecond, microsecond, accuracy. Time Server for FreeBSD, Linux, Windows, Win XP 2000 2K NT, 98, 9x, 95 clients. Timeserver time server. Set up setup configure port installation. Timeserving serving time service browsing. Primer procedure list newbies beginner. Howto synchronize sync synch Unix machines Linux options. Broadcastclient directions steps step-by-step instructions. Cheat Sheet for FreeBSD NTP Installation. Primer for Beginners to Load NTP on FreeBSD. Newbies Installing NTP broadcast client on FreeBSD Guide. Sysadmin: Install and setup NTP on the FreeBSD flavor of UNIX / Linux
|
|
|