KnowHow

技術的なメモを中心にまとめます。
検索にて調べることができます。

SLURMのポート穴あけ(firewalld)

登録日 :2024/08/03 06:37
カテゴリ :SLURM

RockyLinux 8.8のfirewalldでSlurmの通信用に穴を開ける方法は以下の通りです:
Slurmが使用するポートを確認します。一般的に以下のポートが使用されます:

slurmctld (コントローラデーモン): 6817/tcp
slurmd (コンピュートノードデーモン): 6818/tcp
slurmdbd (データベースデーモン): 6819/tcp

firewall-cmdコマンドを使用して、これらのポートを開放します:

sudo firewall-cmd --permanent --add-port=6817/tcp
sudo firewall-cmd --permanent --add-port=6818/tcp
sudo firewall-cmd --permanent --add-port=6819/tcp

変更を適用するために、firewalldを再読み込みします:

sudo firewall-cmd --reload

設定が正しく適用されたか確認します:

sudo firewall-cmd --list-all

これらのコマンドを実行することで、Slurmの通信に必要なポートがfirewalldで開放されます。
注意点:
上記のポート番号はデフォルト設定です。Slurmの設定ファイルで異なるポートを指定している場合は、それに合わせて変更してください。
セキュリティを考慮し、必要最小限のポートのみを開放するようにしてください。
クラスタ内の全てのノードで同様の設定を行う必要があります。
これらの設定により、Slurmクラスタ内での通信が正常に行えるようになります。

実行例
[root@headnode slurm]# sudo firewall-cmd --permanent --add-port=6817/tcp
success
[root@headnode slurm]# sudo firewall-cmd --permanent --add-port=6818/tcp
success
[root@headnode slurm]# sudo firewall-cmd --permanent --add-port=6819/tcp
success
[root@headnode slurm]# sudo firewall-cmd --reload
success
[root@headnode slurm]# sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3 enp0s8
  sources:
  services: cockpit dhcpv6-client ssh
  ports: 6817/tcp 6818/tcp 6819/tcp
  protocols:
  forward: no
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:
[root@headnode slurm]#

Appendix

上記ポートだけでは穴あけが足りなかったようである。
クラインとから、ヘッドノードとの通信がうまくいかない。

[root@compute01 slurm]# scontrol ping
Slurmctld(primary) at headnode is DOWN
*****************************************
** RESTORE SLURMCTLD DAEMON TO SERVICE **
*****************************************

firewalldのログ取得を有効化する

[root@headnode slurm]# sudo firewall-cmd --get-log-denied
off
[root@headnode slurm]# sudo firewall-cmd --set-log-denied=all
success
[root@headnode slurm]# sudo firewall-cmd --get-log-denied
all
[root@headnode slurm]#

firewalldでログを見ると以下のようになる

[root@headnode slurm]# tail -f /var/log/messages
Aug  3 06:47:23 headnode kernel: FINAL_REJECT: IN=enp0s8 OUT= MAC=08:00:27:4b:7e:d1:08:00:27:03:4c:78:08:00 SRC=192.168.56.112 DST=192.168.56.111 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=28669 DF PROTO=TCP SPT=39780 DPT=7817 WINDOW=29200 RES=0x00 SYN URGP=0
Aug  3 06:47:37 headnode kernel: FINAL_REJECT: IN=enp0s8 OUT= MAC=01:00:5e:00:00:fb:0a:00:27:00:00:0b:08:00 SRC=192.168.56.1 DST=224.0.0.251 LEN=231 TOS=0x00 PREC=0x00 TTL=1 ID=14752 PROTO=UDP SPT=5353 DPT=5353 LEN=211

さらに、7818/tcpの穴あけが必要とのこと。

[root@headnode slurm]# sudo firewall-cmd --permanent --add-port=7817/tcp
success
[root@headnode slurm]# sudo firewall-cmd --reload
success
[root@headnode slurm]# sudo firewall-cmd --list-all
public (active)
  target: default
  icmp-block-inversion: no
  interfaces: enp0s3 enp0s8
  sources:
  services: cockpit dhcpv6-client ssh
  ports: 6817/tcp 6818/tcp 6819/tcp 7817/tcp
  protocols:
  forward: no
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

クライアントでヘッドノードをslurmの応答を確認する。
slurmのステータスを取得できたのでうまくいったようである。

[root@compute01 slurm]# scontrol ping
Slurmctld(primary) at headnode is UP
[root@compute01 slurm]#

PARTITION AVAIL  TIMELIMIT  NODES  STATE NODELIST
debug        up      30:00      1   idle headnode
part1        up      30:00      1   idle headnode
part1        up      30:00      1   down compute01
part2        up      30:00      2 drain* node[1-2]
part2        up      30:00      1   down compute01
[root@compute01 slurm]#