1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

PowerVSでゲートウェイのIPアドレスをデフォルトから変更したい

Posted at

今後UIが改善されるかもしれませんが、2025年7月時点でUIに存在する制約をCLIで回避するtipsです。

PowerVSでは、サブネットを作成する際、一般的なネットワークのルールと同様に、最初のIPと最後のIPは予約されています。それを除いたホスト用IPレンジのうち、最初のIPがデフォルトでゲートウェイとして予約され、ユーザーが払い出すサーバーのIPはそれ以外から割り振られる形となります。

例えば192.168.150.0/24の場合、192.168.150.0と192.168.150.255がシステムで予約されており、デフォルトでは192.168.150.1がゲートウェイとして使われ、192.168.150.2-192.168.150.254がサーバー用IPです。

image.png

ここで、192.168.150.1をサーバーに割り振りたい要件があったとします。

UI上でサブネットを作成する際、ゲートウェイアドレスを別のIPに変えることは可能ですが、192.168.150.1は引き続き予約されており、サーバー用に割り当てることができません。

image.png

192.168.150.1を除外すると問題なくなりますが、これでは192.168.150.1をサーバーに割り振りたいという要件を満たせません。
image.png

これは現在のUIを使う際の制約ですが、CLIでサブネットを作成する事で、192.168.150.1をサーバー用IPとして使うことができます。

$ ic pi subnet create subnet01 --cidr-block 192.168.150.0/24 --net-type private --gateway 192.168.150.254
Creating subnet subnet01 under account xxxxxxx as user xxxxxxx...

ID           544fd65e-9cdb-4015-98a9-a50570188972
Name         subnet01
CRN          crn:v1:bluemix:public:power-iaas:tok04:a/27dc483dc1f14d2f821e8b3a4193ad13:7e43b216-4f76-4de6-9baf-339b1fd2304c:network:544fd65e-9cdb-4015-98a9-a50570188972
VLAN         1532
Type         vlan
CIDR Block   192.168.150.0/24
DNS          161.26.0.10, 161.26.0.11
IP Range     [192.168.150.1-192.168.150.253]
Gateway      192.168.150.254
MTU          1450
$ 

CLIで作成後はUI上でも通常のサブネットとして表示されます。

image.png

192.168.150.1を指定してサーバーを作成することも可能です。

image.png

--ip-rangeオプションを指定すると、CLIでも「192.168.150.1は予約済み」というエラーになるため、このオプションは指定せずに作成します。

$ ic pi subnet create subnet01 --cidr-block 192.168.150.0/24 --net-type private --gateway 192.168.150.254 --ip-range "192.168.150.1-192.168.150.253"
Creating subnet subnet01 under account xxxxxxx as user xxxxxxx...
FAILED
Failed to create subnet.

FAILED
Error: [POST /pcloud/v1/cloud-instances/{cloud_instance_id}/networks][400] pcloudNetworksPostBadRequest {"description":"Bad Request: ip address range [192.168.150.1-192.168.150.253] is not valid for cidr 192.168.150.0/24 (note: ip addresses 192.168.150.1 through 192.168.150.1 are reserved and cannot be used); ip address range(s) must be less than or equal to the range [192.168.150.2-192.168.150.254]","error":"Bad Request"}

$ 

サブネットの途中のIPをゲートウェイに指定すると、サーバー用のIPレンジがゲートウェイの前のIPと後のIPで2つに分断されますが、UIで見ると、前半のレンジしか表示されず、後半のレンジは選べなくなるため、その状況を避けたい場合、サブネットの途中のIPを指定しない方が良さそうです。

$ ic pi subnet create subnet01 --cidr-block 192.168.150.0/24 --net-type private --gateway 192.168.150.150
Creating subnet subnet01 under account xxxxxxx as user xxxxxxx...

ID           214c10d9-bbcb-4f10-87aa-b5948aa77669
Name         subnet01
CRN          crn:v1:bluemix:public:power-iaas:tok04:a/27dc483dc1f14d2f821e8b3a4193ad13:7e43b216-4f76-4de6-9baf-339b1fd2304c:network:214c10d9-bbcb-4f10-87aa-b5948aa77669
VLAN         1284
Type         vlan
CIDR Block   192.168.150.0/24
DNS          161.26.0.10, 161.26.0.11
IP Range     [192.168.150.1-192.168.150.149] [192.168.150.151-192.168.150.254]
Gateway      192.168.150.150
MTU          1450
$ 

image.png

以上

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?