前提・実現したいこと
macOSの中にvagrantとvirtual boxを使い、Centos7で仮想環境を1から作っています。
githubにpushした際に時刻がずれていることに気づき、chronyを使い時刻の同期を試みているのですが、うまくいきません。
具体的には、vagrant ssh
でログインした時、sudo systemctl restart chronyd
とchronyを再起動した際などは同期が有効(NTP synchronized: yes
)になっているのですが、macbookを閉じて、再度ログイン画面からmacにログイン、仮想環境の時刻をターミナルで確認をすると、スリープに入った時点から時刻の経過がとまっており、同期もしばらくするとNTP synchronized: no
になります。
chronyの同期を、macのスリープから復帰後も維持するにはどうすればいいか教えていだたきたいです。
chrony.confは以下のようになっています。
# Use public servers from the pool.ntp.org project. # Please consider joining the pool (http://www.pool.ntp.org/join.html). server 0.jp.pool.ntp.org iburst server 1.jp.pool.ntp.org iburst server 2.jp.pool.ntp.org iburst server 3.jp.pool.ntp.org iburst # Record the rate at which the system clock gains/losses time. driftfile /var/lib/chrony/drift # Allow the system clock to be stepped in the first three updates # if its offset is larger than 1 second. makestep 1.0 3 # Enable kernel synchronization of the real-time clock (RTC). rtcsync # Enable hardware timestamping on all interfaces that support it. #hwtimestamp * # Increase the minimum number of selectable sources required to adjust # the system clock. #minsources 2 # Allow NTP client access from local network. #allow 192.168.0.0/16 # Serve time even if not synchronized to a time source. #local stratum 10 # Specify file containing keys for NTP authentication. #keyfile /etc/chrony.keys # Specify directory for log files. logdir /var/log/chrony # Select which information is logged. #log measurements statistics tracking
試したこと
qiita 時刻同期chronyの導入
など、複数の記事を読んでも同じような状態を見つけられませんでした。
そもそも、スリープから復帰時は手作業、もしくは自動化して毎回chronyを再起動しないといけないのでしょうか?
上記の記事にあったこちらのコマンド
sudo systemctl enable chronyd
(chrony自動起動設定)
は打ち込んであります。
スリープから復帰時の状態
$ timedatectl Local time: 金 2019-07-12 20:44:21 JST Universal time: 金 2019-07-12 11:44:21 UTC RTC time: 金 2019-07-12 11:44:20 Time zone: Asia/Tokyo (JST, +0900) NTP enabled: yes NTP synchronized: yes ←しばらくするとnoになります。 RTC in local TZ: no DST active: n/a
$ chronyc sources 210 Number of sources = 4 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- ntp.kiba.net 2 6 77 67 -34us[+2750us] +/- 55ms ^? y.ns.gin.ntt.net 2 6 177 2 -1059s[ -1059s] +/- 111ms ^~ ntp.paina.net 2 6 175 1 -1059s[ -1059s] +/- 62ms ^? ntp-a2.nict.go.jp 1 6 177 1 -1059s[ -1059s] +/- 6561us
↑少したって確認すると、どれかのサーバーには*マークがつくので同期はしていると思われます。
再起動時
$ timedatectl Local time: 金 2019-07-12 21:34:09 JST Universal time: 金 2019-07-12 12:34:09 UTC RTC time: 金 2019-07-12 12:16:29 Time zone: Asia/Tokyo (JST, +0900) NTP enabled: yes NTP synchronized: yes RTC in local TZ: no DST active: n/a
$ chronyc sources 210 Number of sources = 4 MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^- x.ns.gin.ntt.net 2 6 377 18 +127us[ +127us] +/- 73ms ^- ec2-13-230-38-136.ap-nor> 2 6 377 22 -303us[ -303us] +/- 36ms ^- kuroa.me 2 6 377 19 +392us[ +392us] +/- 41ms ^* ntp-b2.nict.go.jp 1 6 377 23 -376us[ -568us] +/- 6932us
補足情報(FW/ツールのバージョンなど)
mac 10.14.5
CentOS Linux release 7.6.1810 (Core)
vagrant

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。