Google Cloud Keeps Changing Hostname

hi guys,
sorry to come back to this again…

I have been running around in circles with this for weeks asking question after question and getting confused as to why answers i am getting are not really working in the way it seems they should.

Now i think i may have narrowed down my problem.

I had believed that a recent comment to simply leave everything as google cloud setup on first install would be best, however, i am concerned that in doing this my mail servers are not going to be resolving properly (I am having problems iwth reverse dns ( only one of the 3 instances below is using the mail server service with at the moment)

I have been playing around with 3 google cloud compute instances using webmin/virtualmin (web hosting and email), Vestacp (hosting only), and ISPconfig (hosting only) control panels.

The ISPConfig instance has a static external ip address, however the other 2 at this stage are dhcp.

All 3 instances are using a dynamically assigned internal ip addresses, although i have not yet seen any of those ip addresses change in 6 months of testing and restarting and deleting and re-deploying. Whenever i delete an instance, the same internal ip sequence is used (ie whatever is the next lowest unassigned available number is re-added as internal ip address).

I am having some problems with forcing google cloud to bloodywell stop changing my hostname -f configuration in my /etc/hosts file.

It should read

127.0.0.1 localhost.localdomain localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

10.x.x.x server1.foo.com.au server1
#10.152.0.3 server1.c.bar.internal server1 # Added by Google
#169.254.169.254 metadata.google.internal # Added by Google

(where x is my ip address, “foo” is my domain name, and “bar” is my google cloud project ID)

However, on any 3 of my instances, as soon as i reboot the instance, the comment i add to the first and second “#added by Google” lines above are removed by google cloud. If i delete the lines all together, google cloud adds them back in again on next restart. ie by default google cloud keeps changing the file to read the same 2 “# added by Google” lines as shown below

127.0.0.1 localhost.localdomain localhost
::1 localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

10.x.x.x server1.foo.com.au server1
10.152.0.3 server1.c.bar.internal server1 # Added by Google
169.254.169.254 metadata.google.internal # Added by Google

(where x is my ip address, “foo” is my actual domain name, and “bar” is my google cloud project ID)

This is really causing me problems and i have no idea on which is the best way around it.

-Do i do it from within google cloud DNS API?
-setup a static internal ip address in google cloud network settings?
-setup a script that continues to check for a change to this file and immediately replace any changes google cloud attempts to make?
-or do i need to change the metadata information on the last line of my hosts file so it does not have “…metadata.google.internal # Added by Google” line?

At present option 1 above is not working. As soon as i enable the DNS API then try to enter it i get a “failed to load” error from within my google cloud console. This is a flaming pain in the ass!!! (i have sent a support request to google…who knows how long it will take for an answer)

I’ve never used Google to host anything. I’m just wondering if I’m understanding your question, or if the forum is munging your formatting. You can use the code tags to format your pasted text which will make it clearer for everybody (see the ‘More information about text formats’ link under the comment box). :slight_smile:

Are you saying the issue is your entries are appearing on the one line after the reboot? Both entries look the same to me, other than the lack of a few line breaks. Or, is it that you want to add your own comments and they disappear? Is there any actual problem with the ip addresses and names?

Anyway, if you can’t figure out a way to resolve it with the Google interface, you might be able to script it so it is rewritten on boot. I’ve occasionally kludged things that way when I’m sick of trying to sort out someone else’s rigid setup.

Hi noisemarine,
I have updated my original post with code tags so it maintains my formatting. (the forum had removed the two comment # hash tags from in front of google lines)
Should make sense now.