分类: LINUX
2006-11-24 09:04:27
1.
telnet
SUNDIAL-1000
2.
cd
/bin
3.
type
./_netconfig to modify the server IP
4.
after
modify IP successful,type ./_genkey to generate keys
(具体参考二级时间服务器配置示例)
1.注释
# restrict default ignore
#:restrict 127.0.0.1
2.增加 server
3
##### 设置广播网段 ########
4
#### 设置本机级别 #########
1 #killall ntpd
2 #ntpd
#ntpq –p
remote refid st
t when poll reach delay
offset jitter
====================================================================
*
LOCAL(0)
LOCAL(0)
当二级服务器与一级服务器时间相差较大时,时间同步调整需要较长时间,这种情况下,可以用命令:ntpdate
修改/etc/ntp.conf
文件(参见:linux客户端ntp.conf示例)
1. 注释
# restrict default ignore
#:restrict 127.0.0.1
2. 增加 server
3. 重新启动ntpd
# killall
ntpd
# ntpd
a.
# cd
/etc/inet
b.
# cp
ntp.client ntp.conf
c
修改/etc/inet/ntp.conf(参见solaris客户端ntp.conf配置示例)
增加server
d 启动ntp
# cd /usr/lib/inet
# xntpd
#ntpq –p
remote refid st t when poll reach delay
offset jitter
======================================================================
*
offset: 本ntp
client 与
当client与sever时间相差较大时,时间同步调整需要较长时间,这种情况下,可以用命令:ntpdate
# Prohibit general access to this
service.
# restrict default ignore
# Permit all access over the loopback
interface. This could
# be tightened as well, but to do so
would effect some of
# the administrative functions.
# restrict 127.0.0.1
# -- CLIENT NETWORK -------
# Permit systems on this network to
synchronize with this
# time service. Do not permit those systems to modify the
# configuration of this service. Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0
notrust nomodify notrap
# --- OUR TIMESERVERS -----
# or remove the default restrict line
# Permit time synchronization with our
time source, but do not
# permit the source to query or modify
the service on this system.
# restrict mytrustedtimeserverip mask
255.255.255.255 nomodify notrap noquery
# server mytrustedtimeserverip
# --- NTP MULTICASTCLIENT ---
#multicastclient # listen on default 224.0.1.1
# restrict 224.0.1.1 mask 255.255.255.255
notrust nomodify notrap
# restrict 192.168.1.0 mask 255.255.255.0
notrust nomodify notrap
#restrict
# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a
fake driver intended for backup
# and when no outside source of
synchronized time is available. The
# default stratum is usually 3, but in
this case we elect to use stratum
# 0. Since the server line does not have
the prefer keyword, this driver
# is never used for synchronization,
unless no other other
# synchronization source is available. In
case the local host is
# controlled by some external source,
such as an external oscillator or
# another protocol, the prefer keyword
would cause the local host to
# disregard all other synchronization
sources, unless the kernel
# modifications are in use and declare an
unsynchronized condition.
#
server
server 127.127.1.0
fudge 127.127.1.0 stratum 3
#### 设置本机级别(小于10大于1),
##### 作用:当一级服务器不可跟踪时,避免二级时间服务器级别成为16,
##### 而导致客户端跟踪不了二级服务器 ,客户端默认级别为10
logconfig all
logfile /var/log/xntpd ###### 日志
#
# Drift file. Put this in a directory which the daemon can
write to.
# No symbolic links allowed, either,
since the daemon updates the file
# by creating a temporary in the same
directory and then rename()'ing
# it to the file.
#
driftfile /etc/ntp/drift
broadcast
broadcast
broadcast
#
# Authentication delay. If you use, or plan to use someday, the
# authentication facility you should make
the programs in the auth_stuff
# directory and figure out what this
number should be on your machine.
#
authenticate no
#
# Keys file. If you want to diddle your server at run
time, make a
# keys file (mode 600 for sure) and
define the key number to be
# used for making requests.
#
# PLEASE DO NOT USE THE DEFAULT VALUES
HERE. Pick your own, or remote
# systems might be able to reset your
clock at will. Note also that
# ntpd is started with a -A flag,
disabling authentication, that
# will have to be removed as well.
#
keys /etc/ntp/keys
# Prohibit general access to this
service.
#restrict default ignore
# Permit all access over the loopback
interface. This could
# be tightened as well, but to do so
would effect some of
# the administrative functions.
#restrict 127.0.0.1
# -- CLIENT NETWORK -------
# Permit systems on this network to
synchronize with this
# time service. Do not permit those systems to modify the
# configuration of this service. Also, do not use those
# systems as peers for synchronization.
# restrict 192.168.1.0 mask 255.255.255.0
notrust nomodify notrap
# --- OUR TIMESERVERS -----
# or remove the default restrict line
# Permit time synchronization with our
time source, but do not
# permit the source to query or modify
the service on this system.
# restrict mytrustedtimeserverip mask
255.255.255.255 nomodify notrap noquery
# server mytrustedtimeserverip
# --- NTP MULTICASTCLIENT ---
#multicastclient # listen on default 224.0.1.1
# restrict 224.0.1.1 mask 255.255.255.255
notrust nomodify notrap
# restrict 192.168.1.0 mask 255.255.255.0
notrust nomodify notrap
# --- GENERAL CONFIGURATION ---
#
# Undisciplined Local Clock. This is a
fake driver intended for backup
# and when no outside source of
synchronized time is available. The
# default stratum is usually 3, but in
this case we elect to use stratum
# 0. Since the server line does not have
the prefer keyword, this driver
# is never used for synchronization,
unless no other other
# synchronization source is available. In
case the local host is
# controlled by some external source,
such as an external oscillator or
# another protocol, the prefer keyword
would cause the local host to
# disregard all other synchronization
sources, unless the kernel
# modifications are in use and declare an
unsynchronized condition.
#
#server 127.127.1.0 # local clock
#fudge 127.127.1.0
stratum 10
#
# Drift file. Put this in a directory which the daemon can
write to.
# No symbolic links allowed, either,
since the daemon updates the file
# by creating a temporary in the same
directory and then rename()'ing
# it to the file.
#
logconfig all
logfile /var/log/xntpd
driftfile /etc/ntp/drift
broadcastdelay 0.008
server
###设置服务器 ,每2的4次方(16秒),产生一同步信号###
#
# Authentication delay. If you use, or plan to use someday, the
# authentication facility you should make
the programs in the auth_stuff
# directory and figure out what this
number should be on your machine.
#
authenticate no
#
# Keys file. If you want to diddle your server at run
time, make a
# keys file (mode 600 for sure) and
define the key number to be
# used for making requests.
#
# PLEASE DO NOT USE THE DEFAULT VALUES
HERE. Pick your own, or remote
# systems might be able to reset your
clock at will. Note also that
# ntpd is started with a -A flag,
disabling authentication, that
# will have to be removed as well.
#
keys /etc/ntp/keys
# @(#)ntp.client 1.2
#
# /etc/inet/ntp.client
#
# An example file that could be copied
over to /etc/inet/ntp.conf; it
# provides a configuration for a host
that passively waits for a server
# to provide NTP packets on the ntp multicast
net.
#
server
###设置服务器 ,每2的4次方(16秒),产生一同步信号###
#multicastclient 224.0.1.1
其他参考资料:
SERVER的配置
2006-06-26 09:41:52
关于NTP SERVER的配置说明
NTP server的安装
如果你的服务器是Linux,请先用如下指令查看本机是否已安装ntp server
rpm -qa|grep ntp
如无,则安装上此RPM包。
也可安装tar包。
配置NTP server
NTP server的主配置文件为/etc/ntp.conf
现对/etc/ntp.conf的各项进行说明
#设置此服务器同上层服务器做时间同步的IP地址,prefer意味着首选IP地址
server 61.246.176.141 prefer
server 210.59.157.10 prefer
server 202.112.7.150 prefer
server 203.116.5.254 #asia.pool.ntp.org
server 202.162.32.12 #1.asia.pool.ntp.org
server 202.155.248.212 #0.asia.pool.ntp.org
#记录上次我们的NTP server与上层NTP server连线时所花费的时间
driftfile /etc/ntp/drift
#设置默认策略为允许任何主机进行时间同步
restrict default ignore
#设置允许访问此时间服务器的时间服务的IP地址
restrict 127.0.0.1 # 开启內部环路lo
restrict 192.168.0.2 # 主机本身的 IP 也同時开启
restrict 211.101.48.56
restrict 192.168.1.0 mask 255.255.255.0 意味着允许192.168.1.0/24子网内主机可同步
restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap #允许任何主机跟此服务器进行时间同步
#指定阶层编号为5,降低其优先度。
fudge 127.127.1.1 stratum 5
#设置ntp日志的path
statsdir /var/log/ntp/
#设置ntp日志文件
logfile /var/log/ntp/ntp.log
keys /etc/ntp/keys
三、NTP server的维护
1、 启动
service ntpd start或者ntpd –p /var/log/ntpd.pid或手工指定配置文件的带path的全名
如ntpd –c /etc/ntp/ntp.conf –p /var/log/ntpd.pid
2、 停止
service ntpd stop
3、 ntpq –p 查看本机和上层服务器的时间同步结果
4、 ntptrace 可以用來追踪某台时间服务器的时间对应关系
5、 ntpdate IP 客户端要和NTP server进行时钟同步。
6、 查看ntp日志/var/log/ntp/ntp.log
四、客户端的配置
LINUX客户端:
echo “10 5 * * * root /usr/sbin/ntpdate 192.168.5.3;/sbin/hwclock -w”>>/etc/crontab
意为每天凌晨的5:10同NTP server进行一次时钟同步,并写入本机BIOS
Solaris客户端:
echo “15 5 * * * /usr/sbin/ntpdate 192.168.5.3”>>/etc/crontab