VMware Cloud Community
sc_2111
Enthusiast
Enthusiast
Jump to solution

Configure NTP

Can anyone point me to the steps needed to configure NTP client on ESX 3.x to sync with an internal NTP server ?

thanks

0 Kudos
1 Solution
20 Replies
conyards
Expert
Expert
Jump to solution

ntp configuration

nano /etc/ntp.conf \[add time servers]

nano /etc/ntp/step-tickers \[add time servers]

esxcfg-firewall --enableservice ntpClient \{case sensitive}

chkconfig --level 345 ntpd on

service ntpd start

hwclock --systohc

clock \[to check time pre post]

ntpdate -q \[ip] to query timesource

from my brief notes on it Smiley Happy

https://virtual-simon.co.uk/
VMwareman85
Contributor
Contributor
Jump to solution

So what if you don't have an NTP server and are using the DC for time, do i follow all the steps use the DC's information instead of NTP?

0 Kudos
Algernon
Enthusiast
Enthusiast
Jump to solution

I have used the PDC emulator in the past and it has worked just fine.

0 Kudos
VMwareman85
Contributor
Contributor
Jump to solution

Thank you Algernon!

0 Kudos
dm3281
Contributor
Contributor
Jump to solution

How would I point my ESX 3 box to use the PDC as a time source?

0 Kudos
Algernon
Enthusiast
Enthusiast
Jump to solution

Here what I did:

1. /etc/ntp.conf[/b]: Add the following

restrict Windows Server IP Address[/i] mask 255.255.255.255 nomodify notrap noquery

server Windows Server FQDN[/i]

2. /etc/ntp/step-tickers[/b]: Add

server Windows Server FQDN[/i]

3. /etc/hosts[/b]: add entry for your Windows time source

4. At console: service ntpd restart

5. At console: chkconfig --level 345 ntpd on

6. At console: /sbin/hwclock --systohc

7. At console: watch ntpq -p

For #7 wait until the asterisk goes beside your PDC emulator or the time source you have specified. It may not be right away and I've had it take a while.

0 Kudos
dm3281
Contributor
Contributor
Jump to solution

Thanks -- I'll try this.

0 Kudos
dsanders
Expert
Expert
Jump to solution

I wrote a script this afternoon to help setup NTP on my ESX servers. There are basically 3 ways to run it:

Interactively - you will be prompted for every NTP server name / IP.

Semi-automatic - specify a file that has a list of NTP servers, you are shown the servers and then you must confirm that they are correct.

Fully automatic - specify a file with a list of NTP servers and they are added with out prompting.

This follows VMware's KB article on setting up NTP with the exception of the hosts file modification (my NTP server is an IP address), if there is a request for that then I can add that as well.

Anyway you can download it here:

http://www.vmcolonel.net/wp-content/uploads/2007/05/set_ntp.zip

Or if you want to read more about it look here:

http://www.vmcolonel.net/?p=13

As I just wrote it this afternoon there has not been extensive testing so use it at your own risk. If you come across any bugs or anything else pelase let me know.

0 Kudos
adithya_bhat
Contributor
Contributor
Jump to solution

Hello dsanders,

Your script worked like a charm, Thanks a ton for this.

Adi-

0 Kudos
mkats
Contributor
Contributor
Jump to solution

Awesome script, thanks VMC

0 Kudos
dboydsto29
Contributor
Contributor
Jump to solution

Awesome script dsanders! Thank you for your time and effort.

0 Kudos
CWedge
Enthusiast
Enthusiast
Jump to solution

My notes from the VMWare Tech Support yesterday:

Change lines in etc/ntp.conf:

#Prohibit general access to this service.

restrict default kod nomodify notrap

Comment out:

\# authenticate yes

\# keys /etc/ntp/keys

From Vcenter ESX HOST ->configuration -> security Profile

Check off NTP, click OK

Done..

He didn't mention anything about changing any other files??

Alse he used a command: watch "ntpq -p"

to see the time sync.

0 Kudos
DBofTLP
Contributor
Contributor
Jump to solution

Killer

Thanks a ton dsanders

0 Kudos
RParker
Immortal
Immortal
Jump to solution

Dude you totally rock. Between you, Algernon and Eric and a few other people on here, we don't need VM Ware anymore.. you guys are good!

0 Kudos
gicti
Enthusiast
Enthusiast
Jump to solution

Thanks a bunch, worked like a charm !

0 Kudos
dsanders
Expert
Expert
Jump to solution

There was a typo in my script. I have modified the code and corrected it. You will want to download the script and run it again. Thanks to Mark Slatem for pointing out the bug. For those interested the type was on the folllowing line:

echo “restrict default kod nomodify notrap” >> ntp.conf.tmp[/code]

I had misspelled nomodify.

0 Kudos
tlyczko
Enthusiast
Enthusiast
Jump to solution

Do the VMs etc. need to be shut down to re-run this script??

Any other preparatory things??

Thank you, Tom

0 Kudos
dsanders
Expert
Expert
Jump to solution

Nothing should be need to be shutdown. This only modifieds the ntp.conf file which just affects the host.

0 Kudos