Tuesday, May 20, 2008

NTP client setup on Solaris/HP/Linux

Steps for setting up NTP client on Solaris 10:

Note: NTP server name in this case is "ntp



# ping ntp
ntp is alive

# cd /etc/inet

# vi ntp.conf
"ntp.conf" 0 lines, 0 characters
driftfile /var/lib/ntp/drift
server ntp
authenticate no
~
~
"ntp.conf" 3 lines, 56 characters


# svcs ntp
disabled May_12 svc:/network/ntp:default

bash-3.00# svcadm enable ntp

bash-3.00# svcs ntp
STATE STIME FMRI
online 14:48:53 svc:/network/ntp:default

bash-3.00# ps -eaf grep ntp
root 5475 5435 0 14:49:07 pts/3 0:00 grep ntp
root 5471 1 2 14:48:54 ? 0:01 /usr/lib/inet/xntpd

bash-3.00# ntpq -p
remote refid st t when poll reach delay offset disp
==============================================================================
serverB serverA 3 u 11 64 1 0.31 -3.220 15875.0


Steps for setting up NTP client on Solaris 8 & 9:


# vi /etc/inet/ntp.conf
"/etc/inet/ntp.conf" [New file]
driftfile /var/tmp/drift
server ntp
authenticate no
~
~
~
~
~
"/etc/inet/ntp.conf" [New file] 3 lines, 52 characters

# touch /var/tmp/drift

# /etc/init.d/xntpd start

# ls -l /etc/rc2.d/S74*
-rwxr--r-- 5 root sys 364 Jan 5 2000 /etc/rc2.d/S74autofs
-rwxr--r-- 5 root sys 911 Jan 5 2000 /etc/rc2.d/S74syslog
-rwxr--r-- 5 root sys 945 Jan 5 2000 /etc/rc2.d/S74xntpd

# ps -eaf grep ntp
root 5390 5372 0 18:11:20 pts/9 0:00 grep ntp
root 5386 1 0 18:10:52 ? 0:00 /usr/lib/inet/xntpd

# ntpq -p
remote refid st t when poll reach delay offset disp
==============================================================================
serverB serverA 3 u 1 64 1 0.44 -1.662 15875.0

Steps for setting up NTP client on RedHat Linux:

# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*clock1.redhat.c .CDMA. 1 u 66 1024 377 80.699 -1.231 0.722

# ls -l /etc/ntp.conf*
-rw-r--r-- 1 root root 2852 Jul 2 2007 /etc/ntp.conf

# cp -p /etc/ntp.conf /etc/ntp.conf.ORIG

# ls -l /etc/ntp.conf*
-rw-r--r-- 1 root root 2852 Jul 2 2007 /etc/ntp.conf
-rw-r--r-- 1 root root 2852 Jul 2 2007 /etc/ntp.conf.ORIG

# service ntpd stop
Shutting down ntpd: [ OK ]

# pgrep ntpd

# cat /dev/null > /etc/ntp.conf

# vi /etc/ntp.conf

# cat /etc/ntp.conf
driftfile /var/lib/ntp/drift
server ntp
authenticate no

# service ntpd start
Starting ntpd: [ OK ]

# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
serverB serverA 3 u 24 64 1 0.220 -4.881 0.004

# pgrep ntpd
1587

Steps for setting up NTP for HP-UX:

# cat /etc/rc.config.d/netdaemons grep -v ^$ grep -v ^#
export INETD_ARGS=
export START_RBOOTD=0
export RBOOTD_DEVICES=
export NTPDATE_SERVER=ntp
export XNTPD=1
export XNTPD_ARGS=
export MROUTED=0
export MROUTED_ARGS=""
export RWHOD=0
export DDFA=0

# cat /etc/ntp.conf
driftfile /var/lib/ntp/drift
server ntp
authenticate no


# /sbin/init.d/xntpd start

# /usr/sbin/ntpq -p
remote refid st t when poll reach delay offset disp
==============================================================================
serverB serverA 3 u 26 64 1 0.46 -1.219 15875.0



NOTE: serverA is NTP server in this case.


After setting up NTP, for first time sync, following command can be used:

# rdate -s serverA


"rdate" sync the date/time with NTP server keeping the local timezone of the client node in mind.

No comments: