Operating System - HP-UX
1824994 Members
2185 Online
109678 Solutions
New Discussion юеВ

disable a client from NTP and set NTP timing backwards

 
SOLVED
Go to solution
Bala_8
Frequent Advisor

disable a client from NTP and set NTP timing backwards

Hi,

My Primary NTP Server :(cook:10.4.37.26)
/etc/ntp.conf contains
server 127.127.1.1 #local clock
peer 10.4.37.27
/etc/rc.config.d/netdaemons contains
export NTPDATE_SERVER=
export XNTPD=1
export XNTPD_ARGS=

My Secondary NTP Server :(Buller:10.4.37.27)
/etc/ntp.conf contains
server 127.127.1.1 #local clock
peer 10.4.37.26
/etc/rc.config.d/netdaemons contains
export NTPDATE_SERVER=cook
export XNTPD=1
export XNTPD_ARGS=

All my Clients
/etc/ntp.conf contains
server cook
server buller
server 127.127.1.1 #local clock in case of disaster
/etc/rc.config.d/netdaemons contains
export NTPDATE_SERVER=cook
export XNTPD=1
export XNTPD_ARGS=

Now i want to set the date backwards to more than a year to do some application BCRT for another two months .... how do i do this?

If i change the time of NTP Server (Primary) will it automatically reflect in all NTP clients immediately, say within next 10 minutes??

Do i need to restart the xntpd services in all my clients ??

2. In the above process i need to exclude one server which is our backup server from this date change, since we use this server for backup of other machines also. How do i disable the NTP Client on this machine???

Thanks for all your guidance, in advance ...

Cheers
-bala-
13 REPLIES 13
Steven E. Protter
Exalted Contributor

Re: disable a client from NTP and set NTP timing backwards

kill the xnptd deamon on the system(s) you want to set the time back on.

Use the date command or SAM to change the system date and time and you are okay unless you need to reboot.

If you need to reboot, you'll need to disable automatic startup of the xntpd daemon.

Best way to do that on a temporary basis is to comment out the activation line in /sbin/init.d/xnptd

Good Luck.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Hi,

I want to set time back on all my machines except the backup server. If i change my time in my Primary NTP Server, i would like to know whether all my clients will set their time backwards automatically??

I want to disable one client, my backup server, from this time change so that it will continue with the current date/time.

cheers
-bala-
T G Manikandan
Honored Contributor

Re: disable a client from NTP and set NTP timing backwards

Yes,it will automatically reflect the change on the NTP clients.

Sometimes when the time difference is more then there can be problems.So you can do a ntpupdate on the client.

You can exclude the backup server by editing the /etc/ntp.conf file and removing the line which has the "server" and also modifying the /etc/rc.config.d/netdaemons and changing the XNTPD=0 and XNTPD_SERVER=

and doing a /sbin/init.d/xntpd stop

Thanks
T G Manikandan
Honored Contributor

Re: disable a client from NTP and set NTP timing backwards

ntpdate not ntpupdate

Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Thanks Mani & Steven ....

BTW if i want to revert the backup server as NTP client, all i need to do is just undo the changes made in /etc/conf & /etc/rc.config.d/netdaemons and start xntpd.

Correct me if i need to something more ...

cheers
-bala-
T G Manikandan
Honored Contributor

Re: disable a client from NTP and set NTP timing backwards

yes you are right.Just do a rollback.


Thanks
Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Hi Mani,

One last question, my Secondary NTP Server (ie., buller) doesn't have "server 10.4.37.26" but instead it have "peer 10.4.37.26".

What does this mean ??? when setting time backwards, do i need to do it on both primary and secondary servers?? Or setting time in Primary Server will be sufficient ???

Cheers
-bala-
T G Manikandan
Honored Contributor

Re: disable a client from NTP and set NTP timing backwards

Yes,the setup should be like that.

Because 'peer' means that the synchronizations happens vice versa.
Like secondary server synchronized to primary server and the primary server syncronized to the secondary server.

This scenario is for failure scenario and is for redundancy.

Like a PDC and BDC.


Thanks
Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Hi,

I had successfully changed the NTP on my network .... but here are some points i want to share with you ....

I changed my system date on NTP Primary Server to year 2002 ... but my NTP Secondary Server and all my clients didn't change their time automatically even after 15 minutes ...
so i log into each of the client machines and did the following :

/sbin/init.d/xntpd stop
ntpdate ntpserverIP
/sbin/init.d/xntpd start
then the timing on the machine has been changed to that of NTP Server .....

Would like to know why it is so ?? I need to set my date back every friday, so that my application testing will carry out with the specified date range every week ...

cheers
-bala-
Bill Hassell
Honored Contributor

Re: disable a client from NTP and set NTP timing backwards

NTP is a VERY complex protocol that does everything possible to prevent a date/time disaster. Changing the server back (or forward) more than a few dozen minutes causes ALL clients to ignore the server completely--the time difference is out of control which would be a disaster for all the clients if they immediately tried to change time.

For example, if the client were out of sync by 10 minutes with the server, it would take 4-8 HOURS to adjust the time on the client, but only if there were no other NTP sources for the client, or all the sources had a reasonably close time value.

NTP will never change the date/time days or weeks forward or reverse. This can only be done using ntpdate which forces a step-change in the date/time. This is done during bootup. NOTE: I would be VERY concerned if you change the date on running machines! Every program, database and even cron/at will be very confused by an online change and for a reboot change, logfiles will be out of order (like wtmp, syslog.log, mail.log, etc). I would hope that these are crash-and-burn machines and not production because the ramifications may be very hard to track down and fix.


Bill Hassell, sysadmin
Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Hi,

These machines are our would-be PRODuction machines .... we want to test our applications performance, reliability, etc on these production systems apart from development and test machines ..... We will set the time back to current one before the application goes live ....
There is a specific need to set our system time to 01/april/2002 to do the test since our test data is as of 31/march/2002 .....
Every friday morning the data will be refreshed with a master copy we had kept as backup and various testing and fixing will go on up to next friday when the data is again refreshed ...
On every friday after refreshing the data, all my systems date must be set to 01/April/2002 before starting all applications on various servers ....

In our development and product test environments i had created a cron job to set the date backwards on every friday morning ....

But in out production environment, NTP thing is configured ..... how do i automate the date change ????

thanks
-bala-
Brian Kinney
Frequent Advisor
Solution

Re: disable a client from NTP and set NTP timing backwards

NTPd is NOT the correct tool for this task. It's meant to keep clocks aligned, not to set them back and forth at a moment's notice.

In fact, your ntp daemon should not even START if the clocks vary by over 1000 seconds! That's why you have to use the ntpdate command before anything works.

Before NTPd came along, most of us used rdate to synchronize our clocks. We'd put it in the crontab and forget about it. You could take a similar approach.

FIRST, turn OFF NTPd on each client of interest! (Trust me....)

NEXT: Create a simple script that uses rsh or ssh to run against each client:
rsh -l root ntpdate cook
or
rsh -l root rdate cook

This is your "update everyone" script.

Congratulations - when you run this script, everyone is sync'd to server cook.

NEXT: You still need some regular time synchronization, since you will run for a week between resets (if I understand it correctly.) Put a line in each CLIENT's crontab to run:
0 * * * * ntpdate cook
to run once an hour.


LASTLY - Although you shouldn't have to, I would highly recommend that you stop any other hosts from even asking cook for the time of day.

He's *wrong* compared to everyone else, so he's not to be trusted. Normally, an NTP client will recognize that "cook" is wrong, and deliberately mark it as not trusted. I wouldn't want to risk the rest of the production environment by confusing their dates.

Remember to comment out the "peer" statements from both cook AND buller ntp.conf scripts. This means stop both ntpd processes, edit both conf files, put cook's clock back into the past, then start both ntpds.

Two Other Useful Suggestions:
1) Don't use "cook" as your time source, use one of your clients instead. That way, you won't have to do any editing in the production environment, merely editing on your special clients.
2) If you use "ntpdate" to sync with, then you will need ntpd running on a client as an NTP server. Therefore I would suggest tp use "rdate" as your sync'ing tool instead.

Brian


"Any sufficiently advanced technology can be indistinguishable from magic" Arthur C. Clarke. My corollary - "Any advanced technology can be crushed with a sufficently large enough rock."
Bala_8
Frequent Advisor

Re: disable a client from NTP and set NTP timing backwards

Thanks Brian .....

But rdate is not available in my servers ....
& rsh is disabled in all my servers except the backup server due to security reasons by the client .....

so the solution i assume, is to change the machine time on all my clients individually by creating cron entries in each clients to execute ntpdate, after making changes to the ntp server time ...

FYI i'm a DBA and doing system admin as beginner .....

cheers
-bala-