3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

IBM Cloud: Power Systems Virtual Server(PowerVS)における、RHEL subscriptionの登録方法

Last updated at Posted at 2023-02-05

1. はじめに

昔は、Power Systems Virtual Server(PowerVS)ではRHELのライセンスはBYOL(Bring Your Own License)が必要だったが、例えばこのrelease notes にもあるように、既にIBM提供のsubscriptionも利用可能となっている。

image.png

今まではPowerVSではAIXしか試していなかったのだが、最近になってRHELが必要になったので、このIBM提供のsubscription付属のRHEL8をプロビジョニングしてみた。すると、subscriptionが登録されていないことに気がついた。

[root@power-rhel8 ~]# subscription-manager identity
This system is not yet registered. Try 'subscription-manager register --help' for more information.

何か注文時に選択を間違ったのか?と思って調べてみると、なんとここに記載の通り、IBM Cloud(x86)環境のプライベート・ネットワーク環境内に存在するCapsule Serverに接続する必要があるようだ。しかも、このCapsule ServerサーバーはIBM Cloud(x86)のサービス・ネットワーク上に存在するため、IBM Cloud(x86)外部からは直接アクセスすることができず、Proxyサーバー経由での接続が必要となる。さらにいうと、初期登録の時だけでなく、yum/dnfなどを実行してパッケージを取得する際にも、このIBM Cloud(x86)内のサービスネットワークにアクセスする必要があるので、Proxyサーバーは以後ずっと必要となる。ここでは、その手順を追ってみる。

2. subscription managerの登録方法

2-1. IBM Cloud(VPC)環境とDirect Linkを接続する

(省略)

2-2. IBM Cloud(VPC)環境上に、Proxyサーバーを作成する。

  • Linuxサーバーを構成し、Proxyサーバーとしてsquidを導入するのが一般的。
  • Security Groupを構成し、Proxyへの接続を許可することを忘れないように。(squidのデフォルトのlistenアドレスは3128)
    • docsにはsecurity groupで443, 8443, 80, 3128に対してポートを開けるように書いてあるが、これは不正確な記述。RHEL on PowerVSからProxy(squid)へのInbound通信は3128しかないので、3128のみをアクセス許可すれば良い。
    • 443, 8443, 80に対してはProxy(squid)からのOutboundなのでデフォルトでは何も実施せずともアクセスが許可されているはずである。。
  • subscription登録実施時に実行する/usr/local/bin/rhel-cloud-init.shの内容を確認すると、80番ポートのhttpアクセスに加えて、8443番ポートを利用したhttpsアクセスも必要としている。squidのデフォルト構成ではacl SSL_ports portとして443のみしか登録されていないし、acl Safe_ports portにも8443は存在しない。よって、以下のような構成が必須である。
    • subscription登録だけであれば80/8443ポートだけが必要であり、443ポートは利用していなさそうなのだが、後でyumを実行してパッケージを取得する際には443ポートを利用するので、設定としてはやはり残しておく必要がある。
/etc/squid.conf
acl SSL_ports port 443 8443
acl Safe_ports port 80          # http
acl Safe_ports port 443         # https
acl Safe_ports port 8443	    # https RHEL subscription manager

2-3. PowerVS上のRHELで、IBM Cloud(VPC)へのルーティングを構成する。

default gatewayはインターネット側に向いているため、IBM Cloud(VPC)側への経路がDirect Link側を使うようにルーティングが必要である。今回は、192.168.50.1がPowerVS上のRHELのPrivate subnetのgatewayであり、IBM Cloud(VPC)は10.台および172.台のプライベートネットワークアドレスで構成しているため、10.0.0.0/8および172.16.0.0/12宛のパケットが192.168.50.1に転送されるようにルーティングを構成する。

image.png

初期構成
[root@power-rhel8 ~]# ip r
default via 192.168.186.57 dev env2 proto static metric 100
192.168.50.0/24 dev env3 proto kernel scope link src 192.168.50.224 metric 101
192.168.50.0/24 via 192.168.50.1 dev env3 proto static metric 101
192.168.186.56/29 dev env2 proto kernel scope link src 192.168.186.58 metric 100

[root@power-rhel8 ~]# nmcli con show
NAME         UUID                                  TYPE      DEVICE
System env2  37fe9be7-145e-ba21-7db0-d3dc75c59862  ethernet  env2
System env3  cb0692b9-1859-e91e-19d9-83ce20b830b9  ethernet  env3
System env4  510335b7-b1c4-1351-9649-bc226a660a9a  ethernet  env4

[root@power-rhel8 ~]# nmcli -f ipv4.routes con show 'System env3'
ipv4.routes:                            { ip = 192.168.50.0/24, nh = 192.168.50.1 }
設定変更
[root@power-rhel8 ~]# nmcli con modify 'System env3' +ipv4.routes "10.0.0.0/8 192.168.50.1"

[root@power-rhel8 ~]# nmcli con modify 'System env3' +ipv4.routes "172.16.0.0/12 192.168.50.1"

[root@power-rhel8 ~]# nmcli -f ipv4.routes con show 'System env3'
ipv4.routes:                            { ip = 192.168.50.0/24, nh = 192.168.50.1 }; { ip = 10.0.0.0/8, nh = 192.168.50.1 }; { ip = 172.16.0.0/12, nh = 192.168.50.1 }

[root@power-rhel8 ~]# nmcli con reload

[root@power-rhel8 ~]# nmcli con down 'System env3' && nmcli con up 'System env3'
Connection 'System env3' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/4)

[root@power-rhel8 ~]# ip r
default via 192.168.186.57 dev env2 proto static metric 100
10.0.0.0/8 via 192.168.50.1 dev env3 proto static metric 103
172.16.0.0/12 via 192.168.50.1 dev env3 proto static metric 103
192.168.50.0/24 dev env3 proto kernel scope link src 192.168.50.224 metric 103
192.168.50.0/24 via 192.168.50.1 dev env3 proto static metric 103
192.168.186.56/29 dev env2 proto kernel scope link src 192.168.186.58 metric 100

これで、IBM Cloud(VPC)上のサーバーに接続が可能となる。

[root@power-rhel8 ~]# ping 10.0.0.4
PING 10.0.0.4 (10.0.0.4) 56(84) bytes of data.
64 bytes from 10.0.0.4: icmp_seq=1 ttl=54 time=1.67 ms
64 bytes from 10.0.0.4: icmp_seq=2 ttl=54 time=1.68 ms
64 bytes from 10.0.0.4: icmp_seq=3 ttl=54 time=1.73 ms
64 bytes from 10.0.0.4: icmp_seq=4 ttl=54 time=1.76 ms

2-4 PowerVS上のRHELで、routeを構成する。subscription登録

/usr/share/powervs-fls/powervs-fls-readme.mdを参照すると、実行するべきコマンドが記載されている。

image.png
ここで、-p Private.proxy.IP.address:3128のところだけを、VPCのProxyを利用するように変更する。今回は、10.0.0.4:3128をProxyサーバーとして構成しているため、以下のようになる。

[root@power-rhel8 ~]# . /usr/local/bin/rhel-cloud-init.sh -a xxxxxxx -u rhha01.updates.jp-tok.iaas.service.networklayer.com -p 10.0.0.4:3128 -o customer -t RHEL
Script is running in background and may take a few minutes. Please do not kill any background process while this runs
/var/log/powervs-fls.log can be tailed for progress
tail -f /var/log/powervs-fls.log

[root@power-rhel8 ~]# tail -f /var/log/powervs-fls.log
Sun Feb  5 13:43:26 UTC 2023:
Sun Feb  5 13:43:26 UTC 2023:  Starting RHEL subscription registration process
Sun Feb  5 13:43:26 UTC 2023:  Cleaning and pre-configuring environment to register power-rhel8 with IBM Subscription Service
Sun Feb  5 13:43:31 UTC 2023:  Authenticating and Registering power-rhel8 with IBM Subscription Service
Sun Feb  5 13:43:38 UTC 2023:  Successfully registered power-rhel8 with IBM Subscription Service
Sun Feb  5 13:43:38 UTC 2023:  Setting up power-rhel8 with proper repositories
Sun Feb  5 13:43:38 UTC 2023:  Pre-configuring and cleaning power-rhel8 Repository information
Sun Feb  5 13:43:40 UTC 2023:  Configuring power-rhel8 with RHEL Repository
Sun Feb  5 13:43:42 UTC 2023:  Successfully configured power-rhel8 with IBM Subscription Service SAP RHEL Repositories
Sun Feb  5 13:43:44 UTC 2023:  Successfully completed RHEL subscription registration process


3. subscription manager/yumの動作確認

Proxyの構成をしないと失敗する。
[root@power-rhel8 ~]# subscription-manager identity
Network error, unable to connect to server. Please see /var/log/rhsm/rhsm.log for more information.

export https_proxy=http://xxxx:3128であって、export https_proxy=https://xxxx:3128ではないことに注意。こちらの記事も参考。

[root@power-rhel8 ~]# export http_proxy=http://10.0.0.4:3128
[root@power-rhel8 ~]# export https_proxy=http://10.0.0.4:3128

[root@power-rhel8 ~]# subscription-manager identity
system identity: 5acf320b-450b-4981-b5f0-71ca7f6ec7c6
name: power-rhel8
org name: customer
org ID: customer
environment name: Library

[root@power-rhel8 ~]# subscription-manager repos --list-enabled
+----------------------------------------------------------+
    Available Repositories in /etc/yum.repos.d/redhat.repo
+----------------------------------------------------------+
Repo ID:   rhel-8-for-ppc64le-supplementary-rpms
Repo Name: Red Hat Enterprise Linux 8 for Power, little endian - Supplementary (RPMs)
Repo URL:  https://rhha01.updates.jp-tok.iaas.service.networklayer.com/pulp/repos/customer/Library/content/dist/rhel8/8.6/ppc64le/supplementary/os
Enabled:   1

Repo ID:   rhel-8-for-ppc64le-appstream-rpms
Repo Name: Red Hat Enterprise Linux 8 for Power, little endian - AppStream (RPMs)
Repo URL:  https://rhha01.updates.jp-tok.iaas.service.networklayer.com/pulp/repos/customer/Library/content/dist/rhel8/8.6/ppc64le/appstream/os
Enabled:   1

Repo ID:   ansible-2-for-rhel-8-ppc64le-rpms
Repo Name: Red Hat Ansible Engine 2 for RHEL 8 ppc64le (RPMs)
Repo URL:  https://rhha01.updates.jp-tok.iaas.service.networklayer.com/pulp/repos/customer/Library/content/dist/layered/rhel8/ppc64le/ansible/2/os
Enabled:   1

Repo ID:   rhel-8-for-ppc64le-baseos-rpms
Repo Name: Red Hat Enterprise Linux 8 for Power, little endian - BaseOS (RPMs)
Repo URL:  https://rhha01.updates.jp-tok.iaas.service.networklayer.com/pulp/repos/customer/Library/content/dist/rhel8/8.6/ppc64le/baseos/os
Enabled:   1

[root@power-rhel8 ~]# dnf install tcpdump
Updating Subscription Management repositories.
Red Hat Enterprise Linux 8 for Power, little endian - AppStream (RPMs)                                                                     48 MB/s |  40 MB     00:00
Red Hat Ansible Engine 2 for RHEL 8 ppc64le (RPMs)                                                                                         15 MB/s | 2.5 MB     00:00
Red Hat Enterprise Linux 8 for Power, little endian - Supplementary (RPMs)                                                                2.5 MB/s | 248 kB     00:00
Red Hat Enterprise Linux 8 for Power, little endian - BaseOS (RPMs)                                                                        65 MB/s |  45 MB     00:00
Last metadata expiration check: 0:00:01 ago on Sun Feb  5 08:59:57 2023.
Package tcpdump-14:4.9.3-3.el8.ppc64le is already installed.
Dependencies resolved.
Nothing to do.
Complete!

[root@power-rhel8 ~]# dnf install bind-utils
Updating Subscription Management repositories.
Red Hat Ansible Engine 2 for RHEL 8 ppc64le (RPMs)                                                                                        124 kB/s | 4.0 kB     00:00
Dependencies resolved.
==========================================================================================================================================================================
 Package                             Architecture                 Version                                    Repository                                              Size
==========================================================================================================================================================================
Installing:
 bind-utils                          ppc64le                      32:9.11.36-3.el8_6.1                       rhel-8-for-ppc64le-appstream-rpms                      456 k
Installing dependencies:
 bind-libs                           ppc64le                      32:9.11.36-3.el8_6.1                       rhel-8-for-ppc64le-appstream-rpms                      182 k
 bind-libs-lite                      ppc64le                      32:9.11.36-3.el8_6.1                       rhel-8-for-ppc64le-appstream-rpms                      1.3 M
 bind-license                        noarch                       32:9.11.36-3.el8_6.1                       rhel-8-for-ppc64le-appstream-rpms                      103 k
 fstrm                               ppc64le                      0.6.1-2.el8                                rhel-8-for-ppc64le-appstream-rpms                       30 k
 protobuf-c                          ppc64le                      1.3.0-6.el8                                rhel-8-for-ppc64le-appstream-rpms                       40 k
 python3-bind                        noarch                       32:9.11.36-3.el8_6.1                       rhel-8-for-ppc64le-appstream-rpms                      151 k

Transaction Summary
==========================================================================================================================================================================
Install  7 Packages

Total download size: 2.2 M
Installed size: 6.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): fstrm-0.6.1-2.el8.ppc64le.rpm                                                                                                      590 kB/s |  30 kB     00:00
(2/7): protobuf-c-1.3.0-6.el8.ppc64le.rpm                                                                                                 734 kB/s |  40 kB     00:00
(3/7): bind-libs-9.11.36-3.el8_6.1.ppc64le.rpm                                                                                            3.0 MB/s | 182 kB     00:00
(4/7): python3-bind-9.11.36-3.el8_6.1.noarch.rpm                                                                                          6.5 MB/s | 151 kB     00:00
(5/7): bind-license-9.11.36-3.el8_6.1.noarch.rpm                                                                                          5.0 MB/s | 103 kB     00:00
(6/7): bind-utils-9.11.36-3.el8_6.1.ppc64le.rpm                                                                                            11 MB/s | 456 kB     00:00
(7/7): bind-libs-lite-9.11.36-3.el8_6.1.ppc64le.rpm                                                                                        19 MB/s | 1.3 MB     00:00
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                      15 MB/s | 2.2 MB     00:00
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                  1/1
  Installing       : bind-license-32:9.11.36-3.el8_6.1.noarch                                                                                                         1/7
  Installing       : fstrm-0.6.1-2.el8.ppc64le                                                                                                                        2/7
  Installing       : protobuf-c-1.3.0-6.el8.ppc64le                                                                                                                   3/7
  Installing       : bind-libs-lite-32:9.11.36-3.el8_6.1.ppc64le                                                                                                      4/7
  Installing       : bind-libs-32:9.11.36-3.el8_6.1.ppc64le                                                                                                           5/7
  Installing       : python3-bind-32:9.11.36-3.el8_6.1.noarch                                                                                                         6/7
  Installing       : bind-utils-32:9.11.36-3.el8_6.1.ppc64le                                                                                                          7/7
  Running scriptlet: bind-utils-32:9.11.36-3.el8_6.1.ppc64le                                                                                                          7/7
  Verifying        : protobuf-c-1.3.0-6.el8.ppc64le                                                                                                                   1/7
  Verifying        : fstrm-0.6.1-2.el8.ppc64le                                                                                                                        2/7
  Verifying        : bind-libs-32:9.11.36-3.el8_6.1.ppc64le                                                                                                           3/7
  Verifying        : python3-bind-32:9.11.36-3.el8_6.1.noarch                                                                                                         4/7
  Verifying        : bind-utils-32:9.11.36-3.el8_6.1.ppc64le                                                                                                          5/7
  Verifying        : bind-license-32:9.11.36-3.el8_6.1.noarch                                                                                                         6/7
  Verifying        : bind-libs-lite-32:9.11.36-3.el8_6.1.ppc64le                                                                                                      7/7
Installed products updated.

Installed:
  bind-libs-32:9.11.36-3.el8_6.1.ppc64le  bind-libs-lite-32:9.11.36-3.el8_6.1.ppc64le  bind-license-32:9.11.36-3.el8_6.1.noarch  bind-utils-32:9.11.36-3.el8_6.1.ppc64le
  fstrm-0.6.1-2.el8.ppc64le               protobuf-c-1.3.0-6.el8.ppc64le               python3-bind-32:9.11.36-3.el8_6.1.noarch

Complete!
3
3
1

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
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?