Tuesday, August 27, 2013

.::: How To Setting NTP Server & Client In Solaris 10 :::.

Setting NTP ( Network Time Protocol) on Solaris 10

Example add the IP NTP Server (example 10.10.10.10) of the "server" and comment out `fudge 127.127.XType.0 stratum 0`

A. Configuring an NTP Server

1. Go to Directory # cd /etc/inet
Log :
root@teguht # cd /etc/inet
root@teguht # ls
datemsk.ndpd             ipnodes                  ipsecinit.sample         networks                 protocols                wanboot.conf.sample
hosts                    ipqosconf.1.sample       mipagent.conf-sample     ntp.client               secret
ike                      ipqosconf.2.sample       mipagent.conf.fa-sample  ntp.server               services
inetd.conf               ipqosconf.3.sample       mipagent.conf.ha-sample  ntp4.client              slp.conf.example
ipaddrsel.conf           ipsecalgs                netmasks                 ntp4.server              sock2path
root@teguht #
root@teguht # ls -lh
total 148
-r--r--r--   1 root     sys           22 Aug  9  2007 datemsk.ndpd
-r--r--r--   1 root     sys           89 Sep  4 13:56 hosts
drwxr-xr-x   4 root     sys          512 Sep  4 12:18 ike
-r--r--r--   1 root     sys         1.1K Sep  4 13:05 inetd.conf
-r--r--r--   1 root     sys          545 Jun 28  2011 ipaddrsel.conf
lrwxrwxrwx   1 root     root           7 Sep  4 12:18 ipnodes -> ./hosts
-r--r--r--   1 root     sys         2.4K Jan 22  2005 ipqosconf.1.sample
-r--r--r--   1 root     sys         3.0K Jan 22  2005 ipqosconf.2.sample
-r--r--r--   1 root     sys         1.1K Jan 22  2005 ipqosconf.3.sample
-r--r--r--   1 root     sys         1.1K May 16  2006 ipsecalgs
-r--r--r--   1 root     sys         2.3K Aug  9  2007 ipsecinit.sample
-rw-------   1 root     sys         6.1K Jan 22  2005 mipagent.conf-sample
-rw-------   1 root     sys         6.1K Jan 22  2005 mipagent.conf.fa-sample
-rw-------   1 root     sys         5.3K Jan 22  2005 mipagent.conf.ha-sample
-r--r--r--   1 root     sys          381 Sep  4 13:56 netmasks
-r--r--r--   1 root     sys          372 Jun 28  2011 networks
-rw-r--r--   1 root     sys          291 Jan 22  2005 ntp.client
-rw-r--r--   1 root     sys         2.7K Jan 22  2005 ntp.server
-rw-r--r--   1 root     sys         3.5K Jul  3  2009 ntp4.client
-rw-r--r--   1 root     sys         4.0K Jul  3  2009 ntp4.server
-r--r--r--   1 root     sys         1.9K Jun 28  2011 protocols
drwx------   3 root     sys          512 Sep  4 12:18 secret
-r--r--r--   1 root     sys         4.5K Sep  4 15:24 services
-rw-r--r--   1 root     sys         5.6K Jan 22  2005 slp.conf.example
-r--r--r--   1 root     sys          784 Sep  4 13:47 sock2path
-r--r--r--   1 root     sys         3.2K Jan 22  2005 wanboot.conf.sample
root@teguht #

2. Copy ntp.server to ntp.conf
Log :
root@teguht # cp /etc/inet/ntp.server /etc/inet/ntp.conf
root@teguht #

3. Edit file ntp.conf using vi editor
Log :
root@teguht # vi /etc/inet/ntp.conf

======================================================================
Edit Code as below
======================================================================
# Either a peer or server.  Replace "XType" with a value from the
# table above.
server 10.10.10.10
#fudge 127.127.XType.0 stratum 0

broadcast 224.0.1.1 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
======================================================================

Before Edit ntp.conf
======================================================================
root@teguht # cat ntp.conf
# ident "@(#)ntp.server 1.7     03/01/17 SMI"
#
# Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# /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
# -------------------------------------------------------
#  1    local     LCL            Undisciplined Local Clock
#  2    trak      GPS            TRAK 8820 GPS Receiver
#  3    pst       WWV            PSTI/Traconex WWV/WWVH Receiver
#  4    wwvb      WWVB           Spectracom WWVB Receiver
#  5    true      TRUE           TrueTime GPS/GOES Receivers
#  6    irig      IRIG           IRIG Audio Decoder
#  7    chu       CHU            Scratchbuilt CHU Receiver
#  8    parse     ----           Generic Reference Clock Driver
#  9    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.XType.0
fudge 127.127.XType.0 stratum 0

broadcast 224.0.1.1 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
root@teguht #
======================================================================

Edit ntp.conf
======================================================================
root@teguht # vi ntp.conf
"ntp.conf" 68 lines, 2809 characters
# ident "@(#)ntp.server 1.7     03/01/17 SMI"
#
# Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# /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
# -------------------------------------------------------
#  1    local     LCL            Undisciplined Local Clock
#  2    trak      GPS            TRAK 8820 GPS Receiver
#  3    pst       WWV            PSTI/Traconex WWV/WWVH Receiver
#  4    wwvb      WWVB           Spectracom WWVB Receiver
#  5    true      TRUE           TrueTime GPS/GOES Receivers
#  6    irig      IRIG           IRIG Audio Decoder
#  7    chu       CHU            Scratchbuilt CHU Receiver
#  8    parse     ----           Generic Reference Clock Driver
#  9    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 10.10.10.10
#fudge 127.127.XType.0 stratum 0

broadcast 224.0.1.1 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
"ntp.conf" 68 lines, 2806 characters 

======================================================================

After Edit ntp.conf
======================================================================
root@teguht # cat ntp.conf
# ident "@(#)ntp.server 1.7     03/01/17 SMI"
#
# Copyright 1996-2003 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#
# /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
# -------------------------------------------------------
#  1    local     LCL            Undisciplined Local Clock
#  2    trak      GPS            TRAK 8820 GPS Receiver
#  3    pst       WWV            PSTI/Traconex WWV/WWVH Receiver
#  4    wwvb      WWVB           Spectracom WWVB Receiver
#  5    true      TRUE           TrueTime GPS/GOES Receivers
#  6    irig      IRIG           IRIG Audio Decoder
#  7    chu       CHU            Scratchbuilt CHU Receiver
#  8    parse     ----           Generic Reference Clock Driver
#  9    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 10.10.10.10
#fudge 127.127.XType.0 stratum 0

broadcast 224.0.1.1 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
root@teguht #
======================================================================

4. touch /var/ntp/ntp.drift
root@teguht # touch /var/ntp/ntp.drift
root@teguht #


5. Refresh daemon NTP
root@teguht # svcadm enable svc:/network/ntp
root@teguht #

6. Check Status NTP is online to monitor ntpd's performance
root@teguht # ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
 teguht          0.0.0.0         16 u    -   64    0     0.00    0.000 16000.0
 224.0.1.1       0.0.0.0         16 u    -   64    0     0.00    0.000 16000.0
root@teguht


B. Configuring an NTP Client 

1. Go to Directory # cd /etc/inet
root@teguht # cd /etc/inet/

2. Copy ntp.client to ntp.conf
root@teguht # cp /etc/inet/ntp.client /etc/inet/ntp.conf
root@teguht # ls
datemsk.ndpd             ipnodes                  ipsecinit.sample         networks                 ntp4.server              sock2path
hosts                    ipqosconf.1.sample       mipagent.conf-sample     ntp.client               protocols                wanboot.conf.sample
ike                      ipqosconf.2.sample       mipagent.conf.fa-sample  ntp.conf                 secret
inetd.conf               ipqosconf.3.sample       mipagent.conf.ha-sample  ntp.server               services
ipaddrsel.conf           ipsecalgs                netmasks                 ntp4.client              slp.conf.example
root@teguht #

3. Edit file ntp.conf using vi editor

Edit ntp.conf as below
======================================================================
#multicastclient 224.0.1.1
server 10.10.10.10 prefer
server 10.10.10.20
driftfile /var/ntp/ntp.drift
======================================================================

Before edit ntp.conf
======================================================================
root@teguht # more 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.
#

multicastclient 224.0.1.1

root@teguht #
======================================================================

After edit ntp.conf
======================================================================
root@teguht # cat /etc/inet/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.
#

#multicastclient 224.0.1.1
server 10.10.10.10 prefer
server 10.10.10.20
driftfile /var/ntp/ntp.drift
root@teguht #
======================================================================

or

or

svcs status svc:/network/ntp

4. touch /var/ntp/ntp.drift
root@teguht # touch /var/ntp/ntp.drift
root@teguht #

5. Refresh daemon NTP
root@teguht # svcadm enable svc:/network/ntp
root@teguht # svcadm refresh svc:/network/ntp
root@teguht # svcadm restart svc:/network/ntp
root@teguht # svcs status svc:/network/ntp

6. Check Status NTP is online # ntpq -p to monitor ntpd's performance
root@teguht # ntpq -p
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
 teguht          0.0.0.0         16 u    -   64    0     0.00    0.000 16000.0
 10.10.10.20     0.0.0.0         16 u    -   64    0     0.00    0.000 16000.0
root@teguht #



source http://fakta-dan-unik.blogspot.com & http://teguhtriharto.blogspot.com
http://sysinfo.bascomp.org/solaris/setting-ntp/
http://camelrichard.org/topics/Solaris/Configuring_NTP_in_Solaris_10

No comments:

Post a Comment

Popular Posts