We have a GCP router that uses an external NAT. The NAT was configured to use automatic "Cloud Nat IP addresses". 2 days ago, without us doing anything, the IP changed.
gcloud compute routers get-nat-ip-info testing-router Return the two IPs:
result:
- natIpInfoMappings:
- mode: AUTO
natIp: YYYYY
usage: IN_USE
- mode: AUTO
natIp: XXXXX
usage: IN_USE
natName: external-nat
I tried editing from GCP console and change the automatic to use the original IP address, but I can an error:
Invalid value for field 'resource.nats[0].natIps[0]': 'projects/XXXX/addresses/nat-auto-ip-XXXX'. NAT_AUTO addresses cannot be used with MANUAL_ONLY mode. Reserve a static address instead.
It's important for me to keep the same IP address, so just re-creating is not an option.
Any idea what can be done?
As per the official GCP document :
“You can switch a Public NAT gateway from automatic NAT IP address allocation to manual NAT IP address assignment; however, the NAT IP addresses cannot be preserved. Even though automatically allocated NAT IP addresses are static, they cannot be moved to a manual NAT IP address assignment.”
Public NAT also automatically removes a NAT IP address when it no longer needs any source ports on that NAT IP address.
So it is not possible to reserve an ephemeral IP address used by Cloud NAT.
So try changing the IP to manual and keep your IP address, but you have the rework of changing your systems and communicating the changes to customers.
You can create a new issue or feature request Issue Tracker thread describing your issue.