質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
NTP

NTP (Network Time Protocol) とは、時計の時刻をネットワーク上のNTPサーバーの持つ正しい時刻に同期するためのプロトコルです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Windows 7

Microsoft Windows 7は過去にリリースされたMicrosoft WindowsのOSであり、Windows8の1代前です。2009年の7月にリリースされ販売されました。Windows7の前はWindowsVistaで、その更に3年前にリリースされました。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Q&A

解決済

1回答

7984閲覧

ntpのjitter、offsetの値が大きくなりすぎて同期されない

kakey1992

総合スコア7

NTP

NTP (Network Time Protocol) とは、時計の時刻をネットワーク上のNTPサーバーの持つ正しい時刻に同期するためのプロトコルです。

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Windows 7

Microsoft Windows 7は過去にリリースされたMicrosoft WindowsのOSであり、Windows8の1代前です。2009年の7月にリリースされ販売されました。Windows7の前はWindowsVistaで、その更に3年前にリリースされました。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

0グッド

0クリップ

投稿2018/11/26 02:57

前提・実現したいこと

ここに質問の内容を詳しく書いてください。
Windows7 上の virtual boxでCentOS7のntpを有効にさせたいと考えています。

ntpの設定は済んだのですが、jitterやoffsetが大きくなりすぎて
いつまでたっても同期されません。

リスタートも何回か試しましたが、状況は改善されず。
syslogは下記のような状況です。

発生している問題・エラーメッセージ

ntp.log

ntp.log

126 Nov 11:38:12 ntpd[7344]: ntpd exiting on signal 15 226 Nov 11:38:12 ntpd[7369]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16 326 Nov 11:38:12 ntpd[7369]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123 426 Nov 11:38:12 ntpd[7369]: Listen and drop on 1 v6wildcard :: UDP 123 526 Nov 11:38:12 ntpd[7369]: Listen normally on 2 lo 127.0.0.1 UDP 123 626 Nov 11:38:12 ntpd[7369]: Listen normally on 3 enp0s3 172.20.241.42 UDP 123 726 Nov 11:38:12 ntpd[7369]: Listen normally on 4 docker0 172.18.0.1 UDP 123 826 Nov 11:38:12 ntpd[7369]: Listen normally on 5 lo ::1 UDP 123 926 Nov 11:38:12 ntpd[7369]: Listen normally on 6 veth33f0e9a fe80::870:b9ff:fe8d:6093 UDP 123 1026 Nov 11:38:12 ntpd[7369]: Listen normally on 7 docker0 fe80::42:eeff:fe23:51a9 UDP 123 1126 Nov 11:38:12 ntpd[7369]: Listen normally on 8 enp0s3 fe80::135a:8df1:5627:c43c UDP 123 1226 Nov 11:38:12 ntpd[7369]: Listen normally on 9 veth9224722 fe80::a0d0:70ff:fea9:f36e UDP 123 1326 Nov 11:38:12 ntpd[7369]: Listening on routing socket on fd #26 for interface updates 1426 Nov 11:38:12 ntpd[7369]: 0.0.0.0 c016 06 restart 1526 Nov 11:38:12 ntpd[7369]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM 1626 Nov 11:38:12 ntpd[7369]: 0.0.0.0 c011 01 freq_not_set 1726 Nov 11:38:21 ntpd[7369]: 0.0.0.0 c61c 0c clock_step +53.744337 s 1826 Nov 11:39:15 ntpd[7369]: 0.0.0.0 c614 04 freq_mode 1926 Nov 11:39:16 ntpd[7369]: 0.0.0.0 c618 08 no_sys_peer

該当のソースコード

ntp.conf

ntp.conf

1 2driftfile /var/lib/ntp/drift 3 4# Permit time synchronization with our time source, but do not 5# permit the source to query or modify the service on this system. 6restrict default nomodify notrap nopeer noquery 7 8# Permit all access over the loopback interface. This could 9# be tightened as well, but to do so would effect some of 10# the administrative functions. 11restrict 127.0.0.1 12restrict ::1 13 14# Hosts on local network are less restricted. 15#restrict 192.168.1.0 mask 255.255.255.0 nomodify notrap 16 17# Use public servers from the pool.ntp.org project. 18# Please consider joining the pool (http://www.pool.ntp.org/join.html). 19server xxx.xxx.xxx.xxx iburst 20#server 0.centos.pool.ntp.org iburst 21#server 1.centos.pool.ntp.org iburst 22#server 2.centos.pool.ntp.org iburst 23#server 3.centos.pool.ntp.org iburst 24 25#broadcast 192.168.1.255 autokey # broadcast server 26#broadcastclient # broadcast client 27#broadcast 224.0.1.1 autokey # multicast server 28#multicastclient 224.0.1.1 # multicast client 29#manycastserver 239.255.254.254 # manycast server 30#manycastclient 239.255.254.254 autokey # manycast client 31 32# Enable public key cryptography. 33#crypto 34 35includefile /etc/ntp/crypto/pw 36 37# Key file containing the keys and key identifiers used when operating 38# with symmetric key cryptography. 39keys /etc/ntp/keys 40 41# Specify the key identifiers which are trusted. 42#trustedkey 4 8 42 43 44# Specify the key identifier to use with the ntpdc utility. 45#requestkey 8 46 47# Specify the key identifier to use with the ntpq utility. 48#controlkey 8 49 50# Enable writing of statistics records. 51#statistics clockstats cryptostats loopstats peerstats 52 53# Disable the monitoring facility to prevent amplification attacks using ntpdc 54# monlist command when default restrict does not include the noquery flag. See 55# CVE-2013-5211 for more details. 56# Note: Monitoring will not be disabled with the limited restriction flag. 57disable monitor 58 59logfile /var/log/ntpstats/ntp.log

serverのIPアドレスはマスクしています。

ntpq -p 実行結果

ntpq

1[root@localhost wekan-backup]# ntpq -p 2 remote refid st t when poll reach delay offset jitter 3============================================================================== 4 xxxxxxxxxxxxxxx xxx.xxx.xxx.xxx 4 u 15 64 17 3.449 59904.8 43768.7 5

サーバ名と、IPアドレスはマスクしてます。offsetとjitterの値がめちゃくちゃ大きいです。

試したこと

ntpdのリスタート

firewalldの下記設定
[root@xxx ~]# firewall-cmd --add-service=ntp --permanent
success
[root@xxx ~]# firewall-cmd --reload
success

補足情報(FW/ツールのバージョンなど)

systemctl status ntp の出力結果は下記の通りです。

* ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: active (running) since Mon 2018-11-26 11:38:12 JST; 12min ago Process: 7368 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 7369 (ntpd) Tasks: 1 Memory: 584.0K CGroup: /system.slice/ntpd.service `-7369 /usr/sbin/ntpd -u ntp:ntp -g Nov 26 11:38:12 localhost.localdomain systemd[1]: Stopping Network Time Service... Nov 26 11:38:12 localhost.localdomain systemd[1]: Starting Network Time Service... Nov 26 11:38:12 localhost.localdomain systemd[1]: Started Network Time Service. Nov 26 11:38:12 localhost.localdomain ntpd[7369]: proto: precision = 0.032 usec Nov 26 11:38:12 localhost.localdomain ntpd[7369]: 0.0.0.0 c01d 0d kern kernel time sync enabled

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

ntpdateで一度合わせてからntpdを立ち上げて下さい
ただしntpdがロードされているとポートが競合するのでntpdateが実行できません
かならずntpdを殺してntpdateを実行、ntpdを起動の順番です

投稿2018/11/26 03:01

yambejp

総合スコア114843

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kakey1992

2018/11/26 03:37 編集

[root@localhost ~]# systemctl stop ntpd [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# systemctl status ntpd * ntpd.service - Network Time Service Loaded: loaded (/usr/lib/systemd/system/ntpd.service; enabled; vendor preset: disabled) Active: inactive (dead) since Mon 2018-11-26 12:19:49 JST; 4s ago Process: 7368 ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS (code=exited, status=0/SUCCESS) Main PID: 7369 (code=exited, status=0/SUCCESS) Nov 26 11:38:12 localhost.localdomain systemd[1]: Stopping Network Time Service... Nov 26 11:38:12 localhost.localdomain systemd[1]: Starting Network Time Service... Nov 26 11:38:12 localhost.localdomain systemd[1]: Started Network Time Service. Nov 26 11:38:12 localhost.localdomain ntpd[7369]: proto: precision = 0.032 usec Nov 26 11:38:12 localhost.localdomain ntpd[7369]: 0.0.0.0 c01d 0d kern kernel time sync enabled Nov 26 12:19:49 localhost.localdomain systemd[1]: Stopping Network Time Service... Nov 26 12:19:49 localhost.localdomain systemd[1]: Stopped Network Time Service. [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# ntpdate -v xxx.xxx.xxx.xxx 26 Nov 12:21:44 ntpdate[7449]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) 26 Nov 12:28:51 ntpdate[7449]: step time server xxx.xxx.xxx.xxx offset 421.164560 sec [root@localhost ~]# date Mon Nov 26 12:28:56 JST 2018 [root@localhost ~]# ntpdate -v xxx.xxx.xxx.xxx 26 Nov 12:29:01 ntpdate[7451]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) 26 Nov 12:29:09 ntpdate[7451]: step time server xxx.xxx.xxx.xxx offset 1.923874 sec [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# systemctl start ntpd [root@localhost ~]# [root@localhost ~]# [root@localhost ~]# systemctl enable ntpd [root@localhost ~]# [root@localhost ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== xxxxxxxxxxxxx xxx.xxx.xxx.xxx 4 u 6 64 1 3.249 826.332 527.437 [root@localhost ~]# [root@localhost ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== xxxxxxxxxxxxx xxx.xxx.xxx.xxx 4 u 12 64 1 3.249 826.332 527.437 しばらくした後↓ [root@localhost ~]# ntpq -p remote refid st t when poll reach delay offset jitter ============================================================================== xxxxxxxxxxxxx xxx.xxx.xxx.xxx 4 u 59 64 1 3.168 6590.65 6104.54
yambejp

2018/11/26 03:58

1.9秒のズレは微妙ですね ntpdateは2,3度やってある程度誤差を潰してからの方がよいかも ntpd.confはきちっとつくってdriftを指定してますか?logはとってますか?
kakey1992

2018/11/26 05:18 編集

そもそもVMの時間が遅れているようで、(現実の30秒でVMが25秒進むくらい) virtualboxExtensionpack(下記参照)を試すも事象解決せず・・・。 https://ichibariki.hatenablog.com/entry/2016/02/22/233024 /var/lib/ntp/driftはntp.confでは指定されていますが、 該当ファイルは存在しないと言う状況でした。 ntpdateは何度やっても誤差はなくなりきりませんでした。 [root@localhost ~]# ntpdate -v 172.17.130.121 26 Nov 13:58:20 ntpdate[2440]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) 26 Nov 13:58:30 ntpdate[2440]: step time server 172.17.130.121 offset 4.030304 sec [root@localhost ~]# [root@localhost ~]# ntpdate -v 172.17.130.121 26 Nov 13:58:31 ntpdate[2441]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) 26 Nov 13:58:38 ntpdate[2441]: step time server 172.17.130.121 offset 0.842755 sec [root@localhost ~]# ntpdate -v 172.17.130.121 26 Nov 13:58:38 ntpdate[2442]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) 26 Nov 13:58:48 ntpdate[2442]: step time server 172.17.130.121 offset 3.064267 sec [root@localhost ~]# ntpdate -v 172.17.130.121 26 Nov 13:58:48 ntpdate[2443]: ntpdate 4.2.6p5@1.2349-o Fri Apr 13 12:52:28 UTC 2018 (1) logはntp.confで下記を指定しています。 logfile /var/log/ntpstats/ntp.log ログは下記のような形です。 26 Nov 14:00:03 ntpd[2461]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16 26 Nov 14:00:03 ntpd[2461]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen and drop on 1 v6wildcard :: UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 2 lo 127.0.0.1 UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 3 enp0s3 172.20.241.42 UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 4 docker0 172.18.0.1 UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 5 lo ::1 UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 6 veth133bf46 fe80::8cef:faff:fe29:5b2c UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 7 veth4c57d58 fe80::bc97:bff:fe5e:eb4a UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 8 docker0 fe80::42:d0ff:fe53:1d6f UDP 123 26 Nov 14:00:03 ntpd[2461]: Listen normally on 9 enp0s3 fe80::135a:8df1:5627:c43c UDP 123 26 Nov 14:00:03 ntpd[2461]: Listening on routing socket on fd #26 for interface updates 26 Nov 14:00:03 ntpd[2461]: 0.0.0.0 c016 06 restart 26 Nov 14:00:03 ntpd[2461]: 0.0.0.0 c012 02 freq_set kernel 0.000 PPM 26 Nov 14:00:03 ntpd[2461]: 0.0.0.0 c011 01 freq_not_set
yambejp

2018/11/26 05:16

あーVMでしてたね。 仮想環境だとntpdはいまいち同期がとれなかった経験があります。 もしどうしてもきびしければ あきらめてcronで5分毎にntpdateを発行するとか思い切った処理が必要かも
kakey1992

2018/11/26 05:19

了解です、ありがとうございます・・・・!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問