vCenter向けNTPサーバ構築手順 (RockyLinux 9.0編)

スポンサーリンク

vCenterはNTPサーバとDNSサーバと併用する事を前提としています。手っ取り早くvCenterを検証したい方向けに、RHEL 8.XまたはRHEL 9.XでNTPサーバを構築する方法をまとめます。

前提

参照資料

動作確認済環境

  • CentOS 8.3
  • Rocky Linux 8.6
  • Rocky Linux 9.0

NTPサーバ(chronyd)の構築

chronyをインストールします。

dnf install chrony

chrony.confを編集します。上位のNTPサーバはインターネットに接続されている状態ならばデフォルト設定でも差し支えないですが、お気に入りのNTPサーバがあれば適宜変更しても良いでしょう。allowは接続を許可するセグメントの指定です。環境に応じて適宜変更ください。

# vi /etc/chrony.conf

 <中略>

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
#pool 2.pool.ntp.org iburst
server ntp.nict.jp iburst
server ntp1.jst.mfeed.ad.jp iburst
server ntp2.jst.mfeed.ad.jp iburst

 <中略>

# Allow NTP client access from local network.
#allow 192.168.0.0/16
allow 192.168.0.0/16

NTPサーバを起動します。

systemctl enable chronyd.service --now

上位のNTPサーバと同期している事を確認します。「*」の表示があれば同期されている事を意味します。

[root@rocky050 ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* ntp-b3.nict.go.jp             1   6    17    17   +112us[ +946us] +/- 2784us
^- ntp1.jst.mfeed.ad.jp          2   6    17    16   -700us[ -700us] +/-   47ms
^- ntp2.jst.mfeed.ad.jp          2   6    17    17   -636us[ -636us] +/-   69ms

firewalldの接続許可

環境によって設定方法は異なりますが、デフォルト設定のfirewalldならば、以下の設定でNTPが使用するudp123を許可する事ができます。

firewall-cmd --add-port=123/udp --zone=external --permanent
firewall-cmd --reload

udp123が確かに許可されている事を確認します。

[root@rocky050 ~]# firewall-cmd --list-all --zone=external

external
  target: default
  icmp-block-inversion: no
  interfaces: 
  sources: 
  services: ssh
  ports: 123/udp
  protocols: 
  masquerade: yes
  forward-ports: 
  source-ports: 
  icmp-blocks: 
  rich rules: 
タイトルとURLをコピーしました