Top/Linux/NTP

NTPはてなブックマーク

計算機の時刻を別の計算機に合わせるために使用するプロトコル。
Linuxではntpd,Windowsでは桜時計などでサーバ・クライアントともに実現できる。
複数回実行する必要がなければntpdateで。

以下では次のように仮定

NTPサーバ1172.16.0.1
NTPサーバ2172.16.0.2

インストール

apt-get install ntp

ntpdate

ntpdate 172.16.0.1
hwclock --systohc

ntpd

vi /etc/ntp.conf
restrict 172.16.0.1 mask 255.255.255.255 nomodify notrap noquery
restrict 172.16.0.2 mask 255.255.255.255 nomodify notrap noquery
#server 127.127.1.0     # local clock
server  172.16.0.1
server  172.16.0.2
#fudge  127.127.1.0 stratum 10
#authenticate yes
authenticate no
/etc/rc.d/init.d/ntpd start
ntpq -p
chkconfig ntpd on

ポート

TCP/UDP 123

関連

Windows/NTP

参考

差分 一覧