このドキュメントでは、Secure Web Proxy が下り(外向き)トラフィックに使用する、独自のエンタープライズ IP アドレスまたは静的 IP アドレスを割り当てる方法について説明します。 Google Cloud
始める前に
初期設定手順を完了します。
Secure Web Proxy 用に予約した静的 IPv4 アドレスのリストがあることを確認します。 Google Cloudで IP アドレスを予約する場合は、
gcloud compute addresses create
コマンドでアドレス リソースを作成します。Google Cloud CLI バージョン 406.0.0 以降がインストールされていることを確認します。
gcloud version | head -n1
以前のバージョンの gcloud CLI がインストールされている場合は、バージョンを更新します。
gcloud components update --version=406.0.0
Secure Web Proxy の静的 IP アドレスを有効にする
手順は次のとおりです。
Secure Web Proxy のプロビジョニング時に割り当てられた Cloud Router 名を特定します。
gcloud compute routers list \ --region REGION \ --filter="network:(NETWORK_NAME) AND name:(swg-autogen-router-*)" \ --format="get(name)"
以下を置き換えます。
REGION
: Cloud Router が Secure Web Proxy 用にデプロイされているリージョンNETWORK_NAME
: VPC ネットワークの名前。
出力は次のようになります。
swg-autogen-router-1
Secure Web Proxy のプロビジョニング時に割り当てられた外部自動プロビジョニングされた IP アドレスを一覧表示します。
gcloud compute routers get-status ROUTER_NAME \ --region=REGION
出力は次のようになります。
に基づいて、自動的にプロビジョニングされた Cloud NAT IP アドレスをスケールアップまたはスケールダウンできます。kind: compute#routerStatusResponse result: natStatus: - autoAllocatedNatIps: - 34.144.80.46 - 34.144.83.75 - 34.144.88.111 - 34.144.94.113 minExtraNatIpsNeeded: 0 name: swg-autogen-nat numVmEndpointsWithNatMappings: 3 network: https://www.googleapis.com/compute/projects/PROJECT_NAME/global/networks/NETWORK_NAME
事前定義された IP 範囲を使用するように Cloud NAT ゲートウェイを更新します。
gcloud compute routers nats update swg-autogen-nat \ --router=ROUTER_NAME \ --nat-external-ip-pool=IPv4_ADDRESSES... \ --region=REGION
IPv4_ADDRESSES
は、使用する外部 IPv4 アドレス リソースの名前に置き換えます。名前はカンマ(,
)で区切ります。IP 範囲が Cloud NAT ゲートウェイに割り当てられていることを確認します。
gcloud compute routers nats describe swg-autogen-nat \ --router=ROUTER_NAME \ --region=REGION
出力は次のようになります。
enableEndpointIndependentMapping: false icmpIdleTimeoutSec: 30 logConfig: enable: false filter: ALL name: swg-autogen-nat natIpAllocateOption: MANUAL_ONLY natIps: - https://www.googleapis.com/compute/projects/PROJECT_NAME/regions/REGION/addresses/ADDRESS sourceSubnetworkIpRangesToNat: ALL_SUBNETWORKS_ALL_IP_RANGES
動的ポート割り当て(DPA)モードを使用するように Cloud NAT ゲートウェイを更新します。DPA モードでは、Secure Web Proxy は割り当てられた IP アドレスを完全に使用できます。
gcloud compute routers nats update swg-autogen-nat \ --router=ROUTER_NAME \ --min-ports-per-vm=2048 \ --max-ports-per-vm=4096 \ --enable-dynamic-port-allocation \ --region=REGION
--min-ports-per-vm
フラグと--max-ports-per-vm
フラグには、それぞれ2048
と4096
の値を使用することをおすすめします。Metrics Explorer を使用して、次の指標データをモニタリングし、必要に応じて DPA の最小値と最大値を調整します。
Cloud NAT Gateway - Port usage
Cloud NAT Gateway - New connection count
Cloud NAT Gateway - Open connections
DPA が有効になっていて、ポートの最小値と最大値が設定されていることを確認します。
gcloud compute routers nats describe swg-autogen-nat \ --router=ROUTER_NAME \ --region=REGION
出力は次のようになります。
enableDynamicPortAllocation: true enableEndpointIndependentMapping: false endpointTypes: - ENDPOINT_TYPE_SWG logConfig: enable: true filter: ERRORS_ONLY maxPortsPerVm: 4096 minPortsPerVm: 2048 name: swg-autogen-nat natIpAllocateOption: MANUAL_ONLY natIps: - https://www.googleapis.com/compute/projects/PROJECT_NAME/regions/REGION/addresses/ADDRESS sourceSubnetworkIpRangesToNat: ALL_SUBNETWORKS_ALL_IP_RANGES type: PUBLIC