Question

Difficulty: MediumManaging Networking Resources

An operations engineer needs to update an existing Cloud NAT gateway named `nat-gateway` managed by Cloud Router `router-central` in the `us-central1` region. The gateway must be updated to use a newly provisioned static regional external IP address named `nat-static-ip` instead of automatically allocated IPs, and detailed logging for all translation connections must be enabled. Which TWO commands should the engineer run to accomplish this setup?

  1. gcloud compute addresses create nat-static-ip --region=us-central1Answer
  2. gcloud compute routers nats update nat-gateway --router=router-central --region=us-central1 --nat-external-ip-pool=nat-static-ip --enable-logging --log-filter=ALLAnswer
  3. C
    gcloud compute addresses create nat-static-ip --global
  4. D
    gcloud compute routers nats update nat-gateway --router=router-central --region=us-central1 --auto-allocate-nat-external-ips --enable-logging

Answer

The engineer must create a regional static external IP address using `gcloud compute addresses create nat-static-ip --region=us-central1` and update the NAT configuration using `gcloud compute routers nats update nat-gateway --router=router-central --region=us-central1 --nat-external-ip-pool=nat-static-ip --enable-logging --log-filter=ALL`.
To assign a specific static IP to a Cloud NAT gateway, a regional external IP address must first be created in the matching region (`us-central1`). Next, the Cloud NAT gateway configuration on the Cloud Router must be updated using `--nat-external-ip-pool` to bind the IP address, alongside `--enable-logging` and `--log-filter=ALL` to capture translation logs.

Step-by-Step Solution

1
Reserve a regional static external IP address in the region where the Cloud NAT gateway resides.
The IP address resource `nat-static-ip` is created in region `us-central1`.
Cloud NAT operates at the regional scope and requires regional external IP addresses.
2
Update the Cloud NAT gateway configuration to attach the static IP and enable translation logging.
The NAT gateway is configured with the specified static IP pool and logs all NAT translations.
The `--nat-external-ip-pool` flag assigns the specific reserved static IP, while `--enable-logging` combined with `--log-filter=ALL` enables connection translation logs.

Key Concept

Cloud NAT configuration and static IP allocation using gcloud CLI
Rate this question