Wednesday 25 January 2012

NTP on windows and linux

NTP (UDP 123)

one config as client and server in ntp.conf (might use another file like drift, keys and step ticker).

you can put "server LOCALHOST" but not necesary, as by defualt the driver creates 127.127.1.0 as ip local and in the config listed as it is.

Windows

1. net time /querysntp
2. net time /setsntp:XXXXXXX
3. net stop w32time ; net start w32time
4. w32tm /config /update
5. w32tm /resync

to test ntp server : w32tm /monitor /computers:xxxx.xxxx.xxx.xx

by GUI : go to "date/time setting", choose the 3rd tab, in the server field just type XXXXXXXXX (good hint!!!) and push synchronized.


Linux

ntpd is the service that sets and maintain system time, use port 123.

ntpdate is command which is not relate to ntp.conf
-- ntpdate -u XXXXXXX (u is used when port 123 is used alry, otherwise "ntp sockets is n used" message appears)

-- ntpdate (will give you "error no server to sync", u must put the server )

-- ntpdate XXXXXX (will update your time following the XXXX time)

-- ntpdate -q xxxxxxx (just testing the xxxxx time)

other command:
ntpd -d --> to see error/debug
ntpq -p --> list all the ntp servers that your pc using.


other errors:
bad file descriptor --> two ntpd are running, kill one of them

no server suitable for sync found --> usually happens when ntpdate -q XXXXXX right after restart ntpd on XXXXXX, wait for some time then try again. After a while ntpd server will be ready.

no associtae id 's returned --> after running ntpq -pn , caused by no "server xxxxx" parameter or no xxxxxx server, notice also if you put 127.127.1.0, do not wrongly mix with 127.127.0.1.


ESX:

For ntp client:
esxcfg-frewall -q ntpClients (-d to disable)

for ntp server:
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1002864

TIPS: stop the iptables on ESX !!!

No comments:

Post a Comment