6
2

ESXi上のAmazonLinux2023でNTP同期を無効化する

Last updated at Posted at 2024-07-19

ESXi上に起動させたAmazonLinux2023でNTP同期を無効化する方法です。フタをあければ何という事は無いのですが知らないとハマりそう、というか見事にハマりましたので自戒を込めて。

1. OS設定変更

まずは以下のコマンドでchronydとsystemd-timesyncd無効化しましょう。

systemctl stop chronyd
systemctl disable chronyd
systemctl stop systemd-timesyncd
systemctl disable systemd-timesyncd

もしtimedatectlでJST9にしている場合は以下のコマンドも実施しておきましょう。

timedatectl set-local-rtc 1 --adjust-system-clock

この時点でいくらdateコマンドを実行しても1分もたたないうちに、時刻が元に戻ってしまいますので次にESXiの設定を変更します。

2 . ESXi設定変更

対象仮想マシンの「設定の編集」開き、仮想マシンオプションの「VMware Tools」のプルダウンをクリックします。

image.png
CentOSなどは「時刻」の「ホストとゲスト時間を同期」にチェックが入っていないのですがAmazonLinux2023はどうやらデフォルトでこれにチェックが入っているようです。。。(知らずに小一時間くらい溶かしました)

チェックを外して保存をクリックします。
image.png

3. 時刻手動変更

あとは、dateコマンドで時刻を変更しましょう。

date -s "2024/07/19 10:00:00"

検証が終わったら、もとに戻しておきましょう。

systemctl start systemd-timesyncd
systemctl enable systemd-timesyncd
systemctl start chronyd
systemctl enable chronyd
6
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
2