I am curious to know if I need to increase the min (Minimum ports per VM instance) port numbers I have configured for my GCP cloud NAT configuration. I am noticing some connection issue.

Just to give you more context I am using Google Cloud Platform's Cloud NAT.

VMs doesn't have external IP going to use Cloud NAT's IP to communicate with internet.

  • You're very unlikely to exhaust the very generous limits on Cloud NAT. What is the connection issue that you are having? – Michael Hampton 2 days ago

I believe the number of port requirement depends on the number of connection that is being opened by services using the Cloud NAT to communicate with an external endpoint. If you would like to know if you are exhausting allocated ports, you might want to enable logging from

Go to "NAT gateway details" Click on EDIT then expand "Logging, minimum ports, timeout" and select logging options

Export Cloud NAT logs to Stackdriver:

  • No logging --disable logging
  • Translation and errors -- Will log Translation and error both
  • Translation only ---Will log Translation only
  • Errors only ---Will log error only.

When the logging is enabled, all collected logs are sent to Stackdriver by default. NAT flow logs provide two types of logs:

  • Translation: a VM instance initiates a connection that is successfully allocated to a NAT IP and port and traverses to the internet
  • Error: a VM instance attempts to connect to the internet by sending a packet over the connection, but the NAT gateway can't allocate a NAT IP and port due to port exhaustion

You can also find the details of gcloud command in Configuring logging section under Cloud NAT logging.

New contributor
user536627 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.