Score:0

How to reset / renew / edit GCP ephemeral external IP?

cn flag

I have dynamic external IP on a GCP VM. I need it to be different. However I tried to restart VM it is always the same. I appreciate that Google is trying to do good for their customers and it is cool to have quasi-static IP for free.. But I need to change it!

Is there simple way to do so ? (I mean without re-creating VM, some CLI command for example?)

EDIT since not even clearing networking settings in the VM properties helps I feel I need to add this picture to demonstrate that the IP is indeed emphemeral: enter image description here

Score:3
cn flag

After some tinkering I found that if you change your external IP to "standard" tier from "premium" you get different IP.

None of the Edd's methods worked with premium tier

John Hanley avatar
cn flag
Your details about standard versus premium is good information.
Score:1
ae flag
Edd

The first and easy way to do it is stop and restart your VM.

"Ephemeral external IP addresses remain attached to a VM instance only until the VM is stopped and restarted or the instance is terminated. If an instance is stopped, any ephemeral external IP addresses that were assigned to the instance are released back into the general Compute Engine pool and become available for use by other projects. When a stopped instance is started again, a new ephemeral external IP address is assigned to the instance."

The second way is deleting the current IP assigned and assign a new one into the VM configuration by doing this:

  1. Select your VM instance.
  2. Click 'Edit'.
  3. In VM instance details, go to Network interfaces and click 'Edit'.
  4. In External IP select 'None'.
  5. Click 'Done'.
  6. Save your changes.
  7. Once the changes are saved, 'Edit' your VM settings again.
  8. Now in Network interfaces select 'Ephemeral'
  9. Click 'Done'.
  10. Save your changes.

You can now validate the new External IP assigned in the VM instances Dashboard.

Third option, depending on your needs, you can reserve a static external IP address, which assigns the address to your project indefinitely until you explicitly release it.

Boppity Bop avatar
cn flag
Thank you. I will try the method 2 later and report.. the method 1 - as I said - tried multiple times - it assigns me the same IP. and its been like that for couple months at least.. and it is NOT static IP.
John Hanley avatar
cn flag
@BoppityBop - Receiving the same ephemeral IP address for a period of months is just pure luck. VMs of the same size typically are created in the same rack of hardware with the same set of IP addresses. The locality would depend on many factors such as VM size, rack utilization, region/zone and how often VMs are created/destroyed on that rack.
Boppity Bop avatar
cn flag
I know right.. but for months it feels more than just luck. i guess GCP is just trying to be more useful if it has resource.. P.S. I couldnt believe that myself. so I started to print in the primary app log the external IP of the machine each time it starts (and it does so twice a week for an hour) and I have this now as a hard fact
Boppity Bop avatar
cn flag
OK method 2 didnt work either! something in this machine config is holding up the IP.. I have no firewall policies on this VM..
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.