pantz.org banner
Configuration of NTP (Network Time Protocol)
Posted on 01-13-2006 01:13:00 UTC | Updated on 01-13-2006 01:13:00 UTC
Section: /software/ntp/ | Permanent Link

Network Time Protocol (NTP) is a protocol used to help synchronize your computer systems clocks with an accurate time source. "Stratum 1" (NTP sites that use an atomic clock for timing) and "Stratum 2" (NTP sites that have slightly less accurate time sources) sites that allow the general public to synchronize with them. You should have at least one server on your network be the local time server for all your other devices (routers, computers, etc), this makes the correlation of system events on different systems much easier. You should also use 3 or more external time servers for your local NTP server.

NTP version 3 is an internet draft standard, formalized in RFC 1305. NTP version 4 is a significant revision of the NTP standard, and is the current development version, but has not been formalized in an RFC. Simple NTP (SNTP) version 4 is described in RFC 2030.

To learn more about NTP and how to configure and use it check out ntp.org.

Don't confuse the above or below with OpenNTPD from the OpenBSD group. Both are an implementation of the Network Time Protocol. They do many of the same things. But they use different looking config files and command options.

Useful programs that work with NTP

* ntpd - Network Time Protocol (NTP) daemon
* ntpq - standard NTP query program
* ntpdc - special NTP query program
* ntpdate - set the date and time via NTP
* ntptrace - trace a chain of NTP servers back to the primary source
* tickadj - set time-related kernel variables
* ntptime - read kernel time variables
* ntp-keygen - generate public and private keys
* ntpdsim - Network Time Protocol (NTP) simulator

The configuration file below is an example of an NTP configuraiton file. Don't confuse this with an OpenNTPD config file. This config file is usually located in the file /etc/ntp.conf.

# ntpd will use syslog() if logfile is not defined
#logfile /var/log/ntpd

driftfile /var/lib/ntp/ntp.drift
statsdir /var/log/ntpstats/

# Extra stats (not needed if you dont want stats)
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

## Allow internel network
restrict 127.0.0.1
restrict 192.168.0.0 mask 255.255.255.0 notrust nomodify notrap

## Example of local time server to query
#server 10.0.10.10
#restrict 10.0.10.10 mask 255.255.255.255 nomodify notrap noquery

## Example of external servers to query
server ntp0.cornell.edu
server ntp-1.ece.cmu.edu
server ntp-2.ece.cmu.edu
server clock-1.cs.cmu.edu
server cuckoo.nevada.edu
server sundial.columbia.edu
server time-b.nist.gov
server time-c.timefreq.bldrdoc.gov
server tock.usno.navy.mil

## Restrict the outsite servers we are quering
restrict ntp0.cornell.edu             mask 255.255.255.255 nomodify notrap noquery
restrict ntp-1.ece.cmu.edu            mask 255.255.255.255 nomodify notrap noquery
restrict ntp-2.ece.cmu.edu            mask 255.255.255.255 nomodify notrap noquery
restrict clock-1.cs.cmu.edu           mask 255.255.255.255 nomodify notrap noquery
restrict cuckoo.nevada.edu            mask 255.255.255.255 nomodify notrap noquery
restrict sundial.columbia.edu         mask 255.255.255.255 nomodify notrap noquery
restrict time-b.nist.gov              mask 255.255.255.255 nomodify notrap noquery
restrict time-c.timefreq.bldrdoc.gov  mask 255.255.255.255 nomodify notrap noquery
restrict tock.usno.navy.mil           mask 255.255.255.255 nomodify notrap noquery

Reddit!

Related stories

Configuration of OpenNTPD
Posted on 11-13-2005 01:13:00 UTC | Updated on 11-13-2005 01:13:00 UTC
Section: /software/ntp/ | Permanent Link

OpenNTPD is a FREE, easy to use implementation of the Network Time Protocol. It provides the ability to sync the local clock to remote NTP servers and can act as NTP server itself, redistributing the local clock. The install below is an example install on OpenBSD. OpenBSD comes with OpenNTPD installed.

1. Create /etc/ntpd.conf if needed. Copy the info from below into the file and edit to suit your needs.

####################################
# OpenNTPD http://www.openntpd.org #
####################################

# $OpenBSD: ntpd.conf,v 1.7 2004/07/20 17:38:35 henning Exp $
# sample ntpd configuration file, see ntpd.conf(5)

# Addresses to listen on (ntpd does not listen by default)
listen on 192.168.0.1

# sync to a single server
#server ntp.example.org

# use a random selection of 8 public stratum 2 servers
# see http://twiki.ntp.org/bin/view/Servers/NTPPoolServers
servers pool.ntp.org

2. Edit the line in /etc/rc.conf and set it to ntpd_flags="-s" so it starts on reboot and syncs the time immediately at startup.

3. Start it by running the command "ntpd -s". Check /var/log/daemon for any errors.

Reddit!

Related stories


RSS Feed RSS feed logo

About


3com

3ware

alsa

alsactl

alsamixer

amd

android

apache

areca

arm

ati

auditd

awk

badblocks

bash

bind

bios

bonnie

cable

carp

cat5

cdrom

cellphone

centos

chart

chrome

chromebook

cifs

cisco

cloudera

comcast

commands

comodo

compiz-fusion

corsair

cpufreq

cpufrequtils

cpuspeed

cron

crontab

crossover

cu

cups

cvs

database

dbus

dd

dd_rescue

ddclient

debian

decimal

dhclient

dhcp

diagnostic

diskexplorer

disks

dkim

dns

dos

dovecot

drac

dsniff

dvdauthor

e-mail

echo

editor

emerald

encryption

ethernet

expect

ext3

ext4

fat32

fedora

fetchmail

fiber

filesystems

firefox

firewall

flac

flexlm

floppy

flowtools

fonts

format

freebsd

ftp

gdm

gmail

gnome

google

gpg

greasemonkey

greylisting

growisofs

grub

hacking

hadoop

harddrive

hba

hex

hfsc

html

html5

http

https

hulu

idl

ie

ilo

intel

ios

iperf

ipmi

iptables

ipv6

irix

javascript

kde

kernel

kickstart

kmail

kprinter

krecord

kubuntu

kvm

lame

ldap

linux

logfile

lp

lpq

lpr

maradns

matlab

memory

mencoder

mhdd

mkinitrd

mkisofs

moinmoin

motherboard

mouse

movemail

mplayer

multitail

mutt

myodbc

mysql

mythtv

nagios

nameserver

netflix

netflow

nginx

nic

ntfs

ntp

nvidia

odbc

openbsd

openntpd

openoffice

openssh

openssl

openvpn

opteron

parted

partimage

patch

perl

pf

pfflowd

pfsync

photorec

php

pop3

pop3s

ports

postfix

power

procmail

proftpd

proxy

pulseaudio

putty

pxe

python

qemu

r-studio

raid

recovery

redhat

router

rpc

rsync

ruby

saltstack

samba

schedule

screen

scsi

seagate

seatools

sed

sendmail

sgi

shell

siw

smtp

snort

solaris

soundcard

sox

spam

spamd

spf

spotify

sql

sqlite

squid

srs

ssh

ssh.com

ssl

su

subnet

subversion

sudo

sun

supermicro

switches

symbols

syslinux

syslog

systemd

systemrescuecd

t1

tcpip

tcpwrappers

telnet

terminal

testdisk

tftp

thttpd

thunderbird

timezone

ting

tls

tools

tr

trac

tuning

tunnel

ubuntu

unbound

vi

vpn

wget

wiki

windows

windowsxp

wireless

wpa_supplicant

x

xauth

xfree86

xfs

xinearama

xmms

youtube

zdump

zeromq

zic

zlib