Link to home
Start Free TrialLog in
Avatar of Steven Vona
Steven VonaFlag for United States of America

asked on

ntpd vs ntpdate - Red Hat (RHEL5)

I was instructed to set up NTP with authentication on our linux machines.  We are using Cisco devices as our time servers on our network.

I tested authentication on one of our RHEL 6 boxes and was able to setup authentication and sync with the server.

As I went to config it on one of our RHEL 5 machines I noticed that there is not ntpdate service, only ntpd.  It was my understanding that ntpd (network time protocol daemon) was the server and ntpdate was the client.  It seems that in RHEL 5 there is no ntpdate, so if I want the machine to ONLY be a client do I use ntpd?

Can someone explain this?  For the RHEL 5 machines am I using ntpd as the client?  Also how can I make it so machines can not look at these clients for time updates?
Avatar of farzanj
farzanj
Flag of Canada image

ntpdate is a utility that is provided by the rpm called 'ntp'.  It is not the client.  For synchronizing you need ntpd installed and configured.  ntpdate would onlyl synchronize once and that too when ntpd is stopped and not running.

you can see if you have it

rpm -qa | grep ntp

Try doing
/usr/sbin/ntpdate

May be you have it just that your path is not adjusted.
ntpd is a daemon that runs to keep your time up to date/time. For this you must configure ntp.conf so it will know where to get the date/time

ntpdate is a command that will use ntp.conf to do an update now as opposed to waiting for ntpd to do it.

If you want you want ntpd, you need to configure ntp.conf. You CAN use ntpdate to do manual updates.

http://www.brennan.id.au/09-Network_Time_Protocol.html
With ntpdate command, you can provide the name of time server manually too and that would eliminate the need of having /etc/ntp.conf file at all.

service ntpd stop
ntpdate <servername>
service ntpd start


Regardless, you need to provide server parameter in /etc/ntp.conf to keep your time synchronized.
To see your jitter and time and whether your time server is synchronized or not, you can issue the following command

ntpq -p
You no need to stop and start again the ntpd deamon. You can execute the ntpdate command while ntpd deamon is running but you need to use -d for the same.

# ntpdate -d <Time server name/ip>

If you will not use -d with ntpdate then you would require to stop the ntpd service.
Avatar of Steven Vona

ASKER

Ok, I understand what everyone is trying to say here and I appreciate it.  BUT, as you can see below ntpdate is clearly set up as a service with its own startup scripts in /etc/init.d/.  This is in RHEL 6


# chkconfig --list | grep ntp
ntpd                 0:off      1:off      2:off      3:off      4:off      5:off      6:off
ntpdate              0:off      1:off      2:on      3:on      4:on      5:on      6:off


# ls -lrt /etc/init.d/ntp*
-rwxr-xr-x. 1 root root 1866 Oct 22  2009 /etc/init.d/ntpdate
-rwxr-xr-x. 1 root root 1923 Oct 22  2009 /etc/init.d/ntpd


Also I can start ntpdate without starting ntpd


# service ntpd status
ntpd is stopped
# service ntpdate start
ntpdate: Synchronizing with time server:                   [  OK  ]


As I said, ntpdate can be done, or could be done till RHEL5 when ntpd was NOT running.  Could you actually run ntpdate when ntpd WAS running?
ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
And as upanwar mentioned that you CAN run ntpdate with option -d.  Thanks upanwar.
@faranj

That link to fedoraforum.org is exactly what I needed to explain ntpdate as a service.

Now I have just one more question, how can I make it so ntpd will NOT answer queries for time on machines I want to only be clients?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial