Solaris-NTP時間同步

来源:互联网 发布:凡科网站源码下载 编辑:程序博客网 时间:2024/06/01 09:57
 

Solaris 8/9 NTP Configuration Process

 

 

NTP Server :10.87.0.9

NTP Client : 10.87.0.241

 

(1)   On Server :

[1] Edit ntp.conf

root@TESTMACHINE #cd /etc/inet

root@TESTMACHINE # ls

datemsk.ndpd             mipagent.conf.fa-sample  ntp.server

hosts                    mipagent.conf.ha-sample  protocols

inetd.conf               netmasks                 services

ipnodes                  networks                 slp.conf.example

ipsecinit.sample         ntp.client               sock2path

mipagent.conf-sample     ntp.conf

root@TESTMACHINE #vi ntp.conf

# @(#)ntp.server        1.5     99/09/21 SMI

#

# /etc/inet/ntp.server

#

# An example file that could be copied over to /etc/inet/ntp.conf and

# edited; it provides a configuration template for a server that

# listens to an external hardware clock, synchronizes the local clock,

# and announces itself on the NTP multicast net.

#

 

# This is the external clock device.  The following devices are

# recognized by xntpd 3-5.93e:

#

# XType Device    RefID          Description

# -------------------------------------------------------

   local     LCL            Undisciplined Local Clock

   trak      GPS            TRAK 8820 GPS Receiver

   pst       WWV            PSTI/Traconex WWV/WWVH Receiver

   wwvb      WWVB           Spectracom WWVB Receiver

   true      TRUE           TrueTime GPS/GOES Receivers

   irig      IRIG           IRIG Audio Decoder

   chu       CHU            Scratchbuilt CHU Receiver

   parse     ----           Generic Reference Clock Driver

   mx4200    GPS            Magnavox MX4200 GPS Receiver

# 10    as2201    GPS            Austron 2201A GPS Receiver

# 11    arbiter   GPS            Arbiter 1088A/B GPS Receiver

# 12    tpro      IRIG           KSI/Odetics TPRO/S IRIG Interface

# 13    leitch    ATOM           Leitch CSD 5300 Master Clock Controller

# 15                       TrueTime GPS/TM-TMD Receiver

# 17    datum     DATM           Datum Precision Time System

# 18    acts      ACTS           NIST Automated Computer Time Service

# 19    heath     WWV            Heath WWV/WWVH Receiver

# 20    nmea      GPS            Generic NMEA GPS Receiver

# 22    atom      PPS            PPS Clock Discipline

# 23    ptb       TPTB           PTB Automated Computer Time Service

# 24    usno      USNO           USNO Modem Time Service

# 25                       TrueTime generic receivers

# 26    hpgps     GPS            Hewlett Packard 58503A GPS Receiver

# 27    arc       MSFa           Arcron MSF Receiver

#

# * All TrueTime receivers are now supported by one driver, type 5.

  Types 15 and 25 will be retained only for a limited time and may

  be reassigned in future.

#

# Some of the devices benefit from "fudge" factors.  See the xntpd

# documentation.

 

# Either a peer or server.  Replace "XType" with a value from the

# table above.

server 127.127.1.0  prefer

fudge 127.127.1.0  stratum 10

 

#broadcast 10.87.0.0  ttl 4

 

enable auth monitor

driftfile /var/ntp/ntp.drift

statsdir /var/ntp/ntpstats/

filegen peerstats file peerstats type day enable

filegen loopstats file loopstats type day enable

filegen clockstats file clockstats type day enable

 

keys /etc/inet/ntp.keys

trustedkey 0

requestkey 0

controlkey 0

 

 

[2] Stop/Start NTP Service :

root@TESTMACHINE # /etc/init.d/xntpd start
root@TESTMACHINE #
/etc/init.d/xntpd stop

  [3]Check NTP Service Running :

    root@TESTMACHINE #ps -ef|grep ntp

    root  5192     0 17:14:29 ?        0:00 /usr/lib/inet/xntpd

    root  5408  4717  0 17:52:45 pts/2    0:00 grep ntp

 

 

(2)   On Client:

[1] Edit ntp.conf

root@testserver01 #cd /etc/inet

root@testserver01 # ls

datemsk.ndpd             mipagent.conf.fa-sample  ntp.server

hosts                    mipagent.conf.ha-sample  protocols

ike                      netmasks                 secret

inetd.conf               networks                 services

ipnodes                  ntp.client               slp.conf.example

ipsecinit.sample         ntp.cluster              sock2path

mipagent.conf-sample     ntp.conf                 wanboot.conf.sample

root@testserver01 #vi ntp.conf

# ident "@(#)ntp.client 1.3     00/07/17 SMI"

#

# /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 10.87.0.9

#multicastclient 10.87.0.0

driftfile /var/ntp/ntp.drift

 

[2] Stop/Start NTP Service :

root@testserver01 #/etc/init.d/xntpd start
root@testserver01 #
/etc/init.d/xntpd stop

  [3]Check NTP Service Running :

    root@testserver01 #ps -ef|grep ntp

    root  5192     0 17:14:29 ?        0:00 /usr/lib/inet/xntpd

    root  5408  4717  0 17:52:45 pts/2    0:00 grep ntp

 

 [4]Check Client and Server時間差:

 root@testserver01 #ntpdate -q 10.87.0.9

server 10.87.0.9, stratum 11, offset -0.000428, delay 0.02727

 6 Jun 17:59:47 ntpdate[10012]: adjust time server 10.87.0.9 offset -0.000428 sec

 

[5]Stop Auto-Sync,Start Manual-Sync:

root@testserver01 #ntpdate 10.87.0.9

  6 Jun 18:13:34 ntpdate[10018]: the NTP socket is in use, exiting

root@testserver01 #ps -ef|grep ntp

   root 10019  9907  0 18:13:52 pts/1    0:00 grep ntp

    root  9988     0 17:22:16 ?        0:00 /usr/lib/inet/xntpd

root@testserver01 #kill -9 9988

root@testserver01 #ps -ef|grep ntp

    root 10023  9907  0 18:15:41 pts/1    0:00 grep ntp

root@testserver01 #ntpdate 10.87.0.9

 6 Jun 18:15:48 ntpdate[10025]: adjust time server 10.87.0.9 offset -0.000834 sec

root@testserver01 #ps -ef|grep ntp

    root 10026  9907  0 18:16:02 pts/1    0:00 grep ntp

root@testserver01 #ntpdate 10.87.0.9

 6 Jun 18:16:07 ntpdate[10028]: adjust time server 10.87.0.9 offset 0.000447 sec

 

 

 

原创粉丝点击