
GCPのドキュメントでは、ファイアウォールルールを作成する際にIPv6アドレスがサポートされていると記載されていますが(詳しくはこちら) どうやら実現できないようです。このドキュメントから:
- ファイアウォール ルールは IPv4 接続をサポートします。IPv6 が有効になっている VPC ネットワークでは、IPv6 接続もサポートされます。上りルールの送信元または下りルールの送信先をアドレスで指定する場合、CIDR 表記で IPv4 または IPv6 アドレスまたはブロックを指定できます。
- 各ファイアウォール ルールには IPv4 または IPv6 の範囲のいずれかを含めることができますが、両方を含めることはできません。
ただし、IPv6 アドレスを使用してファイアウォール ルールを作成しようとすると、以下のスクリーンショットに示すように、エラーが発生し、保存できません。
上記の例は私が試した 2 つの例を示していますが、単一のアドレス、CIDR ブロックの有無などを試しました。そして、それらはすべて拒否されました。VPC サブネットで IPv6 が有効になっていることを確認しました。
何か見逃しているのでしょうか?
答え1
GUI も機能しませんが、同等の gcloud コマンドを使用してファイアウォール ルールを正常に作成できました。
テストするために、新しい VPC、新しいサブネット、新しいファイアウォール ルールを作成しました。
error@cloudshell:~ (strange-passage-193919)$ gcloud compute networks create ipv6test --project=strange-passage-193919 --subnet-mode=custom --mtu=1460 --bgp-routing-mode=regional
Created [https://www.googleapis.com/compute/v1/projects/strange-passage-193919/global/networks/ipv6test].
NAME SUBNET_MODE BGP_ROUTING_MODE IPV4_RANGE GATEWAY_IPV4
ipv6test CUSTOM REGIONAL
Instances on this network will not be reachable until firewall rules
are created. As an example, you can allow all internal traffic between
instances as well as SSH, RDP, and ICMP by running:
$ gcloud compute firewall-rules create <FIREWALL_NAME> --network ipv6test --allow tcp,udp,icmp --source-ranges <IP_RANGE>
$ gcloud compute firewall-rules create <FIREWALL_NAME> --network ipv6test --allow tcp:22,tcp:3389,icmp
error@cloudshell:~ (strange-passage-193919)$ gcloud compute networks subnets create ipv6test --project=strange-passage-193919 --range=10.16.0.0/20 --network=ipv6test --region=us-west2
Created [https://www.googleapis.com/compute/v1/projects/strange-passage-193919/regions/us-west2/subnetworks/ipv6test].
NAME REGION NETWORK RANGE STACK_TYPE IPV6_ACCESS_TYPE IPV6_CIDR_RANGE EXTERNAL_IPV6_CIDR_RANGE
ipv6test us-west2 ipv6test 10.16.0.0/20 IPV4_ONLY
error@cloudshell:~ (strange-passage-193919)$ gcloud compute networks subnets update ipv6test --project=strange-passage-193919 --stack-type=IPV4_IPV6 --ipv6-access-type=EXTERNAL --region=us-west2
Updated [https://www.googleapis.com/compute/v1/projects/strange-passage-193919/regions/us-west2/subnetworks/ipv6test].
error@cloudshell:~ (strange-passage-193919)$ gcloud compute --project=strange-passage-193919 firewall-rules create ruletest --direction=INGRESS --priority=1000 --network=ipv6test --action=ALLOW --rules=tcp:22 --source-ranges=2001:db8::/32
Creating firewall...⠹Created [https://www.googleapis.com/compute/v1/projects/strange-passage-193919/global/firewalls/ruletest].
Creating firewall...done.
NAME NETWORK DIRECTION PRIORITY ALLOW DENY DISABLED
ruletest ipv6test INGRESS 1000 tcp:22 False
error@cloudshell:~ (strange-passage-193919)$