Atribuir endereços IP estáticos para o tráfego de saída
Mantenha tudo organizado com as coleções
Salve e categorize o conteúdo com base nas suas preferências.
Este documento mostra como atribuir seus próprios endereços IP corporativos ou
estáticos Google Cloud que o Secure Web Proxy usa para o tráfego de saída.
Confira se você tem uma lista de endereços IPv4 estáticos reservados para usar com o
Proxy da Web seguro. Se você quiser reservar endereços IP em Google Cloud, consulte o
comando gcloud compute addresses create para criar um recurso de
endereço.
Verifique se você tem a versão 406.0.0 ou mais recente da Google Cloud CLI instalada:
gcloud version | head -n1
Se você tiver uma versão anterior da CLI gcloud instalada, atualize a versão:
gcloud components update --version=406.0.0
Ativar endereços IP estáticos para o Secure Web Proxy
Faça o seguinte:
Identifique o nome do Cloud Router atribuído durante o provisionamento do Secure Web Proxy:
gcloud compute routers list \
--region REGION \
--filter="network:(NETWORK_NAME) AND name:(swg-autogen-router-*)" \
--format="get(name)"
Substitua:
REGION: a região em que o Cloud Router é
implantado para o Proxy seguro da Web
NETWORK_NAME: o nome da rede
VPC.
O resultado será assim:
swg-autogen-router-1
Liste os endereços IP externos provisionados automaticamente atribuídos durante o provisionamento do proxy da Web seguro:
Atualize o gateway do Cloud NAT para usar o modo de alocação de porta dinâmica (DPA, na sigla em inglês). O modo DPA permite que o Secure Web Proxy use totalmente os endereços IP
atribuídos.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-27 UTC."],[],[],null,["# Assign static IP addresses for egress traffic\n\nThis document shows you how to assign your own enterprise IP addresses, or\nstatic Google Cloud IP addresses, that Secure Web Proxy uses for egress traffic.\n\nBefore you begin\n----------------\n\n- Complete the [initial setup\n steps](/secure-web-proxy/docs/initial-setup-steps).\n\n- Ensure that you have a list of static IPv4 addresses reserved to use for\n Secure Web Proxy. If you want to reserve IP addresses in Google Cloud, see the\n [`gcloud compute addresses create` command](/sdk/gcloud/reference/compute/addresses/create) to create an address\n resource.\n\n- Verify that you have the Google Cloud CLI version 406.0.0 or later installed:\n\n gcloud version | head -n1\n\n If you have an earlier gcloud CLI version installed, update the version: \n\n gcloud components update --version=406.0.0\n\nEnable static IP addresses for Secure Web Proxy\n-----------------------------------------------\n\nDo the following:\n\n1. Identify the Cloud Router name assigned during Secure Web Proxy\n provisioning:\n\n gcloud compute routers list \\\n --region \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e \\\n --filter=\"network:(\u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e) AND name:(swg-autogen-router-*)\" \\\n --format=\"get(name)\"\n\n Replace the following:\n - \u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e: the region that the Cloud Router is deployed for Secure Web Proxy\n - \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e: the name of your VPC network\n\n The output is similar to the following: \n\n swg-autogen-router-1\n\n2. List the external automatically provisioned IP addresses assigned during\n Secure Web Proxy provisioning:\n\n gcloud compute routers get-status \u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n The output is similar to the following: \n\n kind: compute#routerStatusResponse\n result:\n natStatus:\n - autoAllocatedNatIps:\n - 34.144.80.46\n - 34.144.83.75\n - 34.144.88.111\n - 34.144.94.113\n minExtraNatIpsNeeded: 0\n name: swg-autogen-nat\n numVmEndpointsWithNatMappings: 3\n network: https://www.googleapis.com/compute/projects/PROJECT_NAME/global/networks/NETWORK_NAME\n\n | **Note:** In the preceding output, the `swg-autogen-nat` Cloud NAT gateway has four automatically provisioned IP addresses. The Secure Web Proxy can scale up or scale down automatically provisioned Cloud NAT IP addresses based on your Google Cloud workload.\n3. Update the Cloud NAT gateway to use your predefined IP range:\n\n gcloud compute routers nats update swg-autogen-nat \\\n --router=\u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e \\\n --nat-external-ip-pool=\u003cvar translate=\"no\"\u003eIPv4_ADDRESSES\u003c/var\u003e... \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n Replace \u003cvar translate=\"no\"\u003eIPv4_ADDRESSES\u003c/var\u003e with the name of the external\n IPv4 address resource that you intend to use, separated by a comma (`,`).\n4. Verify that your IP range is assigned to the Cloud NAT gateway:\n\n gcloud compute routers nats describe swg-autogen-nat \\\n --router=\u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n The output is similar to the following: \n\n enableEndpointIndependentMapping: false\n icmpIdleTimeoutSec: 30\n logConfig:\n enable: false\n filter: ALL\n name: swg-autogen-nat\n natIpAllocateOption: MANUAL_ONLY\n natIps:\n - https://www.googleapis.com/compute/projects/PROJECT_NAME/regions/REGION/addresses/ADDRESS\n sourceSubnetworkIpRangesToNat: ALL_SUBNETWORKS_ALL_IP_RANGES\n\n5. Update the Cloud NAT gateway to use Dynamic Port Allocation (DPA)\n mode. DPA mode allows Secure Web Proxy to fully use the assigned IP\n addresses.\n\n gcloud compute routers nats update swg-autogen-nat \\\n --router=\u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e \\\n --min-ports-per-vm=2048 \\\n --max-ports-per-vm=4096 \\\n --enable-dynamic-port-allocation \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n For `--min-ports-per-vm` and `--max-ports-per-vm` flags, we recommend that\n you use values `2048` and `4096`, respectively.\n\n Use [Metrics Explorer](https://cloud.google.com/monitoring/charts/metrics-selector#basic-advanced-mode)\n to monitor metrics data for the following and adjust DPA minimum and maximum\n values as needed:\n - `Cloud NAT Gateway - Port usage`\n - `Cloud NAT Gateway - New connection count`\n - `Cloud NAT Gateway - Open connections`\n6. Verify that your DPA is enabled and the minimum and maximum port values\n are set:\n\n gcloud compute routers nats describe swg-autogen-nat \\\n --router=\u003cvar translate=\"no\"\u003eROUTER_NAME\u003c/var\u003e \\\n --region=\u003cvar translate=\"no\"\u003eREGION\u003c/var\u003e\n\n The output is similar to the following: \n\n enableDynamicPortAllocation: true\n enableEndpointIndependentMapping: false\n endpointTypes:\n - ENDPOINT_TYPE_SWG\n logConfig:\n enable: true\n filter: ERRORS_ONLY\n maxPortsPerVm: 4096\n minPortsPerVm: 2048\n name: swg-autogen-nat\n natIpAllocateOption: MANUAL_ONLY\n natIps:\n - https://www.googleapis.com/compute/projects/PROJECT_NAME/regions/REGION/addresses/ADDRESS\n sourceSubnetworkIpRangesToNat: ALL_SUBNETWORKS_ALL_IP_RANGES\n type: PUBLIC\n\nWhat's next?\n------------\n\n- [Use tags to create policies](/secure-web-proxy/docs/use-tags)\n- [Use a URL list to create policies](/secure-web-proxy/docs/use-url-list)"]]