web-dev-qa-db-ja.com

NTPが自動的に大量に更新されることを許可しますか?

これが私のシナリオです。ワークステーションで複数のVMを実行して、実稼働環境をシミュレートします。 1日の終わりに、午後6時にワークステーションを(VMをバックグラウンドで実行して)スリープします。翌朝午前8時にオフィスに戻り、ワークステーションをスリープ解除すると、すべてのVMは午後6時になります。

リセットの疲れNTPまたは単に更新を強制することを覚えている、私は5分のcronに以下を入れました

service ntp stop && ntpd -gq && service ntp start

これが私の/etc/ntp.conf

tinker panic 0

driftfile /var/lib/ntp/ntp.drift

logfile /var/log/ntpd.log

# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/

statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See http://www.pool.ntp.org/join.html for
# more information.
server 0.ubuntu.pool.ntp.org
server 1.ubuntu.pool.ntp.org
server 2.ubuntu.pool.ntp.org
server 3.ubuntu.pool.ntp.org

# Use Ubuntu's ntp server as a fallback.
server ntp.ubuntu.com

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html for
# details.  The web page <http://support.ntp.org/bin/view/Support/AccessRestrictions>
# might also be helpful.
# 
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery
restrict -6 default kod notrap nomodify nopeer noquery

# Local users may interrogate the ntp server more closely.
restrict 127.0.0.1
restrict ::1

# Clients from this (example!) subnet have unlimited access, but only if
# cryptographically authenticated.
#restrict 192.168.123.0 mask 255.255.255.0 notrust


# If you want to provide time to your local subnet, change the next line.
# (Again, the address is an example only.)
#broadcast 192.168.123.255

# If you want to listen to time broadcasts on your local subnet, de-comment the
# next lines.  Please do this only if you trust everybody on the network!
#disable auth
#broadcastclient

これを達成するためのより良い方法はありますか?

3
chrisan

VMware Workstation(またはVMware vSphere)を使用している場合は、 (Linux)仮想マシンで計時を処理する特定の方法 があります。しかし、それはあなたの睡眠状況には十分ではありません。 NTPゲストの内部-ここでは役に立ちません。

絶対にVMwareゲストツールをゲスト仮想マシンにインストールし、NTPがホストで実行されていることを確認する必要があります。これにより、ゲストが一時停止されたときに発生するスリープの問題とドリフトが修正されます。

編集:

ああ、それはUbuntuです...多くのUbuntuユーザーがネイティブのVMwareツールスイートをインストールしていないことがわかりました。 これがステップです (そしてビデオ)これを達成するために。

3
ewwhite

iburstを使用すると、時計をより迅速に設定するのにも役立ちますが、これはサービスの開始時にのみ有効です。

ほとんどのアプリケーションは、serverコマンドでiburstオプションを指定することをお勧めします。このオプションを使用すると、メッセージのボレーが交換されてデータが整理され、約10秒で時計が設定されます。

APCI再開時にサービスを再開する方法を理解する必要があります。 ( これを試すことができます。)

1
Aaron Copley

Ntp.confが機能するはずです! ntpdがかなりの時間差を修正するのにかなりの時間がかかることがあることがわかりました。 (実際に修正するのに12時間以上かかるのを見ました)。

(cronジョブなしで)一晩放置すると、最終的には自動的に修正されることがわかります。

1
blacklight