LoginSignup
7
6

More than 3 years have passed since last update.

IBM Cloud: VPCのVirtual Private Endpoint機能について試してみた

Last updated at Posted at 2020-11-08

1. はじめに

IBM Cloudのサービスは、Public endpointとPrivate endpointを持ちます。Virtual Private Endpoints (VPE) とは、

  1. 指定したVPCからのみ
  2. Private endpointへ
  3. VPC内で定義されるPrivate IPを使って

アクセスするための機能です。
https://cloud.ibm.com/docs/vpc?topic=vpc-about-vpe&locale=en

従来もClassic InfrastructureやVPCからPrivate endpointにアクセスする機能(Service endpoint)自体は提供されていました。しかし、Private NWに接続可能な環境からはどこからでもアクセス可能であり、そのIPアドレスは161.26.x.x166.9.x.xなどの共通のアドレス帯が利用されていました。これらの制約を取り除かれたものがVPEだと言えるでしょう。
https://qiita.com/testnin2/items/b3f3a112cb21ad8c07e9
https://cloud.ibm.com/docs/vpc?topic=vpc-service-endpoints-for-vpc#cloud-service-endpoints
https://cloud.ibm.com/docs/account?topic=account-vrf-service-endpoint#use-service-endpoint

2. 仕組みと制約

  • VPEの構成要素
    • Endpoint Gateway: 一般的にサービスインスタンスごとに作成される。仮想化されており、負荷に応じて水平方向にスケールする。VPC内の全てのAZにまたがって構成されており、冗長化されている。https://cloud.ibm.com/docs/vpc?topic=vpc-about-vpe&locale=en
    • Reserved IP: 各サービスインスタンスにアクセスするためのIPアドレスとしてVPC内のNWから予約・構成されるIPアドレス。このIPアドレスは別Zoneからもアクセスもできるので単一Zoneのみに作成することも可能だが、各ZoneごとにReserved IPを構成するのがBest Practiceのようだ。https://cloud.ibm.com/docs/vpc?topic=vpc-about-vpe#vpe-connectivity&locale=en
      image.png
  • 利用可能なIBM Cloudのサービス一覧は以下の通り(どのサービスもVPEに対応できているわけではない)
    https://cloud.ibm.com/docs/vpc?topic=vpc-vpe-supported-services&locale=en
  • VPEに対するSecurity Groupを使ったアクセス制御はできない。サーバー側のSecurity Groupを利用するか、Network ACLを使った制御は可能。VPEを使うのであれば、Service Endpoint経由で直接アクセスしないように、Network ACLでOutboundをブロックすることがセキュリティーの観点からは推奨。
  • Reserved IPのIPアドレスを明示的に指定して作成することはできない。
  • 1つのendpoint gatewayには、1つのAZにつき1つのReserved IPしか割り当てられない。
  • 同じサーバーから同時にVPEおよびService Endpointを使ってIBM Cloudのサービスにアクセスすることはサポートしない(セッションとかの問題があるから?)https://cloud.ibm.com/docs/vpc?topic=vpc-planning-considerations&locale=en

3. NTPサービスのVPEを注文してみる

  • VPCよりVirtual private endpoint gatewaysを選択
    image.png
  • Createを選択
    image.png
  • VPE Gatewayの名称などを選択
    image.png
  • NTPを選択。NTPはどこのリージョンからも利用できるGlobal Service扱い。
    image.png

  • 初めてサービスを作成するときにはReserved IPは存在していないので、Select one for meから新規に作成する。
    image.png

  • VPE Gatewayが作成された
    image.png

  • 詳細画面を見ると、Reserved IPが作成されている。別ZoneのReserved IPを作成したい場合は、この画面から追加可能。
    image.png

  • Tokyo2に対してReserved IPを追加。
    image.png

  • 最終的にTokyo1/Tokyo2/Tokyo3にReserved IPを作成した結果。
    image.png

4. テスト

4.1 VPEのReserved IPにping

VSI@tokyo1からReservedIP@tokyo1へのping
[root@syasuda-tok1-vpc1 ~]# ping 10.0.0.16 -c 3
PING 10.0.0.16 (10.0.0.16) 56(84) bytes of data.
64 bytes from 10.0.0.16: icmp_seq=1 ttl=62 time=0.282 ms
64 bytes from 10.0.0.16: icmp_seq=2 ttl=62 time=0.300 ms
64 bytes from 10.0.0.16: icmp_seq=3 ttl=62 time=0.254 ms

--- 10.0.0.16 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.254/0.278/0.300/0.027 ms
VSI@tokyo1からReservedIP@tokyo2へのping
[root@syasuda-tok1-vpc1 ~]# ping 10.1.0.36 -c 3
PING 10.1.0.36 (10.1.0.36) 56(84) bytes of data.
64 bytes from 10.1.0.36: icmp_seq=1 ttl=62 time=0.288 ms
64 bytes from 10.1.0.36: icmp_seq=2 ttl=62 time=0.314 ms
64 bytes from 10.1.0.36: icmp_seq=3 ttl=62 time=0.297 ms

--- 10.1.0.36 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.288/0.299/0.314/0.022 ms
VSI@tokyo1からReservedIP@tokyo3へのping
[root@syasuda-tok1-vpc1 ~]# ping 10.2.0.9 -c 3
PING 10.2.0.9 (10.2.0.9) 56(84) bytes of data.
64 bytes from 10.2.0.9: icmp_seq=1 ttl=62 time=0.252 ms
64 bytes from 10.2.0.9: icmp_seq=2 ttl=62 time=0.292 ms
64 bytes from 10.2.0.9: icmp_seq=3 ttl=62 time=0.245 ms

--- 10.2.0.9 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.245/0.263/0.292/0.020 ms

別Zoneに割り当てたReserved IPなのにpingの応答が速い!?(本来だったら、別Zoneへのpingならば、1.7msecぐらいかかっているはずだが・・・)。
想像だが、

  • Tokyo1 -> Tokyo2 -> VPE Gateway(10.1.0.36)
  • Tokyo1 -> Tokyo3 -> VPE Gateway(10.2.0.9)

という迂回をしてVPE Gatewayにアクセスしているのではなく、

  • Tokyo1 -> VPE Gateway(10.0.0.16, 10.1.0.36, 10.2.0.9)

とVPE Gatewayへの優先経路を利用してアクセスしているように見える。

4.2 VPEのReserved IPを使ってNTPを構成

このやり方に従って実際に設定してみる。

Classic InfrastructureにおけるNTPのendpointアドレスは

  • 10.0.77.54(Classic Infrastructure): servertime.service.softlayer.com/time.service.softlayer.com/time.service.networklayer.com
  • 161.26.0.6(Service Endpoint) time.adn.networklayer.com/mirrors.adn.networklayer.com

だったが、VPEでは10.0.0.16, 10.1.0.36, 10.2.0.9などが使えるようになっているはず。

[root@webapp1-tok1-8x2hoq6oid-htiyf ~]# timedatectl
      Local time: 月 2020-11-09 04:44:16 JST
  Universal time: 日 2020-11-08 19:44:16 UTC
        RTC time: 日 2020-11-08 19:45:44
       Time zone: Asia/Tokyo (JST, +0900)
     NTP enabled: yes
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a

[root@webapp1-tok1-8x2hoq6oid-htiyf ~]# chronyc sources
210 Number of sources = 1
MS Name/IP address         Stratum Poll Reach LastRx Last sample
===============================================================================
^* 10.0.0.16                     3   6    17    53    +18us[+4329ns] +/-  144ms
7
6
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
7
6