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?

More than 1 year has passed since last update.

VPCのApplication Load Balancerの名前解決をプライベートNWからのみ許可する

Last updated at Posted at 2023-03-30

はじめに

VPCのApplication Load Balancer(ALB)は、これまで、プライベートタイプであってもlb.appdomain.cloudドメイン配下にFQDNで作られ、インターネットからも名前解決できる仕様でした(名前解決先がプライベートIPなので外からは繋がりませんが。)
 
今回、ALBがDNS Servicesと連携することにより、ユーザーがDNS Services上に作成したドメインでALBのFQDNが作られ、VPC内からのみ名前解決できる構成にすることが可能になりました。
https://cloud.ibm.com/docs/vpc?topic=vpc-lb-dns&interface=ui

実際に試してみます。

サービス間の権限を許可する

今回の機能を使うために、ALBからDNS Servicesを操作できる必要があります。(ALBのFQDNに対応したAレコードがDNS Services上に作成され、ALBのメンテナンス等で実IPが変わったら都度更新されるため。)
そのため、IAMのAuthorizationの画面で、ALBからDNS Servicesに対する権限を付与します。

https://cloud.ibm.com/iam/authorizations
ソースとなるサービスに、VPC Infrastructure Serviceの中から、Resource typeとしてLoad Balancer for VPCを選択します。
image.png

ターゲットとなるサービスにDNS Servicesを選択し、Service accessにManager権限を付けます。
image.png

下記の権限が追加されます。
image.png

DNS Services

DNS Servicesにゾーンを作成します。レコードの作成は不要です(後ほどALBにより自動的にAレコードが作成されます)。
image.png

ALB作成

ALBのオーダー画面で、DNS type=Privateを選択すると、DNS ServicesにこのALBのレコードが作られることになります。
DNS typeにPrivateを選択すると、DNS ServicesをBindできるUIが出てきます。
image.png

DNS Servicesのインスタンス名とゾーンを選択します。
image.png

image.png

その他、いつも通り、ALBを配置するVPCやサブネットを選択し、ALBをオーダーすると、ALBの作成中に、DNS Servicesの該当ゾーンにALB用のAレコードが追加されました。
image.png

ALBの管理画面上も、いつものlb.appdomain.cloudドメインでなく、独自ドメインで作成されています。
image.png

動作確認

プライベートDNSに作成したドメインなので、インターネット上のDNSでは名前解決できません。

PCからnslookup
% nslookup 7b4f004d-jp-tok.tmgw.local
Server:		192.168.3.1
Address:	192.168.3.1#53

** server can't find 7b4f004d-jp-tok.tmgw.local: NXDOMAIN

% 

DNS Servicesで許可したVPC内のVSIからは、名前解決できます。

VPC内のVSI
# nslookup 7b4f004d-jp-tok.tmgw.local
Server:		161.26.0.7
Address:	161.26.0.7#53

Non-authoritative answer:
Name:	7b4f004d-jp-tok.tmgw.local
Address: 172.16.50.4
Name:	7b4f004d-jp-tok.tmgw.local
Address: 172.16.60.4

# 

Custom Resolverを作成し、それを参照すれば、Direct Link越しにも名前解決できます。

Direct Link越しにCustom Resolverを参照
# nslookup 7b4f004d-jp-tok.tmgw.local
Server:         172.16.50.12
Address:        172.16.50.12#53

Name:   7b4f004d-jp-tok.tmgw.local
Address: 172.16.60.4
Name:   7b4f004d-jp-tok.tmgw.local
Address: 172.16.50.4

# 

以上

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