Operating System - HP-UX
1748259 Members
4032 Online
108760 Solutions
New Discussion юеВ

Re: ntp client configuration

 

ntp client configuration

Hi,

 

I want to configure ntp client in my server. The OS is HP-UX 11.11. Can you just give me the procesure how can i do that? Also in my server there are oracle database running that are time dependent. Should I stop the database before config? Also should i have to reboot the server after ntp configuration?

 

Plz help me. i have to do the config ASAP.

 

Regards,

Arafat

4 REPLIES 4
Bill Hassell
Honored Contributor

Re: ntp client configuration

There are a couple of steps to setup NTP, but first you must verify that your server is capable of reaching an reference NTP server. If your network administrator has setup a local NTP server, use that server, typically by IP address as often the DNS server is not setup with a stable hostname for the NTP server's address. Firewalls and/or routers are often setup to act as an NTP server.

 

If you don't have a local NTP server, use the NTP pool for your server. The pool collects multiple NTP servers to provide an accurate source of time information. To find a server for your location, go to

 

http://www.pool.ntp.org/en/use.html

 

For the US, a server to test will be north-america.pool.ntp.org so test connectivity with:

 

ntpq -p north-america.pool.ntp.org

 

 

You should see something like this:

 

# ntpq -p north-america.pool.ntp.org
     remote           refid      st t when poll reach   delay   offset    disp
==============================================================================
 69.22.157.2     ntp.your.org     2 u 336d 1024    0    21.69   -4.619 15937.5
-time.anycast.re ntp.cox.net      2 u  243 1024  377    21.59    4.525   14.85
-swisstime.ee.et swisstime2.ee.e  2 u  776 1024  377   105.51   -0.113   18.69
*ntp0.rrze.uni-e .GPS.            1 u  533 1024  377    90.40    0.028   18.68
+ntps1-0.eecsit. .PPS.            1 u  161 1024  377   101.77   -0.079   14.85
-ntp0.nl.uu.net  .PPS.            1 u  781 1024  377    93.79   -1.448   14.84
-ntp1.nl.uu.net  .PPS.            1 u  244 1024  377    95.35   -1.672   18.66
+ntp.alaska.edu  .GPS.            1 u  271 1024  377   112.01    0.252   14.84

 



The actual server names and values will be different as the pool changes the servers regularly to spread the load. If you get a timeout or response error message, port 123 is not open on your network and you'll need to followup with your network administrator to allow NTP service.

 

Replace the file /etc/ntp.conf (which is full of comments) with:

 

    server north-america.pool.ntp.org
    fudge 127.127.1.1 stratum 10    # localhost if NTP servers fail
    driftfile /etc/ntp.drift

 



Now since you indicated that you are running Oracle, all databases and applications that use timestamps for records must be put into read-only mode or shutdown to prevent errors when the time jumps.

 

Edir the file /etc/rc.config.d/netdaemons and modify these lines:

 

    export NTPDATE_SERVER=north-america.pool.ntp.org
    export XNTPD=1
    export XNTPD_ARGS="-l /var/adm/xntpd.log"

 



As mentioned earlier, replace the NTP pool server with the one(s) associated with your location.

 

And that's it for configuration. Once your time-sensitive applications and databases have been stopped, you can manually set the time to be close to current time. But most important, make sure that your current login has the correct timezone:

 

   

echo $TZ

 

 

If not, change the TZ value to your local timezone before setting the time of day. Use the date command to set the time. This is required to make sure that the time difference is small so that NTP can make a small adjustment to bring the time to match the NTP server(s). Now start the NTP server:

 

  

 /sbin/init.d/xntpd start

 

 

You will see a message that shows the adjustment and from now (including a reboot), the time will be synchronized, typically less than one second.



Bill Hassell, sysadmin

Re: ntp client configuration

Hi Bill,

Thanks for your suggestion. The timezone is ok. and the current time of the server is ok now. Should I reboot the server after the service start ?

 

 

Dennis Handly
Acclaimed Contributor

Re: NTP client configuration

>Should I reboot the server after the service start?

 

No, there is no need to do that.  Especially if the time is fine.

Bill Hassell
Honored Contributor

Re: ntp client configuration

When you start the xntpd service, it will immediately jump the time to the correct setting. From then on, NTP will automatically keep the time of day clock in sync.



Bill Hassell, sysadmin