配置ntp server and client.

sntp -r <ntp server ip> // force ntp client synchronized ntp server.

cd /usr/share/zoneinfo/Asia //
cp Shanghai /etc/localtime // change time zone to CST

hwclock --show // show hardware time.
hwclock --systohc // change hardware time to system time.

ntpq -p // check ntp status.

/etc/init.d/ntp restart // ntp service restart.


ntp server:
add a line 'server 127.127.1.0 mode 5 prefer' to /etc/ntp.conf,
use '/etc/init.d/ntp restart' restart ntp service.
use 'ntpq -p' check the status.
eg:
wing-up-fr-179:/usr/share/zoneinfo/Asia # ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
*LOCAL(0) .LOCL. 5 l 16 64 377 0.000 0.000 0.001

if there is a "*" before 'LOCAL(0)', then ntp server is OK, it will take serval minutes.

ntp client:
add a line 'server <ntp server ip>' to /etc/ntp.conf,
use '/etc/init.d/ntp restart' restart ntp service.
use 'sntp -r <ntp server ip>' to force synchronized.

 

你可能感兴趣的:(server)