# retaining hostname after new infrastructure

**URL:** <https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192>\
**Category:** Amazon-EC2\
**Created:** [October 8, 2014, 6:31pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192 "2014-10-08T18:31:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![monoclesys](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@monoclesys](https://forums.suse.com/u/monoclesys)\
**Post date:** [October 8, 2014, 6:31pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/1 "2014-10-08T18:31:43Z")

</div>

Greetings,

After updating some of our SLES 11 sp3 AWS instances to use the new infrastructure (per instructions in this blog post: [https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/](https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/)) our instances no longer retain their hostname. After rebooting, our systems hostnames are reset. For example, our test box was called “susetest” but after a reboot:

jfriesen@ip-10-16-31-137:~\> hostname  
ip-10-16-31-137

Even though in “yast network” → Network Card → Hostname/DNS we ensure that the “Change Hostname via DHCP” checkbox is de-selected. Every time we reboot now, we lose our hostnames, and it seems like no settings in yast can fix the problem. This was not an issue before the infrastructure change. Anyone have any ideas?

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [October 8, 2014, 7:43pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/2 "2014-10-08T19:43:00Z")

</div>

On 10/08/2014 09:34 AM, monoclesys wrote:[color=blue]

> Greetings,
> 
> After updating some of our SLES 11 sp3 AWS instances to use the new  
> infrastructure (per instructions in this blog post:  
> [https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/](https://www.suse.com/communities/conversations/suse-linux-enterprise-server-aws-updates-shellshock/))  
> our instances no longer retain their hostname. After rebooting, our  
> systems hostnames are reset. For example, our test box was called  
> “susetest” but after a reboot:
> 
> jfriesen@ip-10-16-31-137:~\> hostname  
> ip-10-16-31-137[/color]

Besides unchecking that checkbox, did you set a new hostname value on the NIC?

Do you need the hostname for anything other than the prompt of your shell?  
If not, you could hack that pretty easily. Similarly, you could have  
your old hostname work with new IPs via an /etc/hosts hack. Still, I do  
not know of any reason why setting the hostname would be something lost  
during a reboot unless the new infrastructure had some odd tentacles that  
forced a change back, which doesn’t make sense to me.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [October 8, 2014, 8:06pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/3 "2014-10-08T20:06:56Z")

</div>

I’m guessing you’re on AWS since your hostname looks similar to mind; I  
have not tried this out yet, just FYI:

[http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html)

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![monoclesys](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@monoclesys](https://forums.suse.com/u/monoclesys)\
**Post date:** [October 12, 2014, 6:45pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/4 "2014-10-12T18:45:10Z")

</div>

Thanks for your thoughts ab. Yes, this issue only affects our AWS-based SuSE instances, which used to work just fine, until a couple weeks ago when SuSE upgraded their infrastructure. That upgrade replaced a lot of the startup scripts and seem to have broken the part that allowed us to preserve hostnames across reboots. (hostname is import to us as the software running on them expects the “hostname” command to return the configured hostname and not ip-a.b.c.d). I’m hoping someone from SuSE reads these forums. In the meantime I’m looking for the part of the script that is overwriting /etc/HOSTNAME so that I can fix it myself.

---

<div class="post-metadata">

**Author:** ![monoclesys](https://avatars.discourse-cdn.com/v4/letter/m/7993a0/32.png) [@monoclesys](https://forums.suse.com/u/monoclesys)\
**Post date:** [October 12, 2014, 7:57pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/5 "2014-10-12T19:57:54Z")

</div>

I think I found it. The new SuSE AWS infrastructure uses the cloud-init package and there is a new config file associated with it, /etc/cloud/cloud.cfg, with a parameter that must be set:

preserve\_hostname: true

I’m not sure if the setting in YaST is completely ignored or if it must be set in conjunction with /etc/cloud/cloud.cfg.

---

<div class="post-metadata">

**Author:** ![wallwood](https://avatars.discourse-cdn.com/v4/letter/w/b9e5f3/32.png) [@wallwood](https://forums.suse.com/u/wallwood)\
**Post date:** [September 18, 2015, 3:13pm UTC](https://forums.suse.com/t/retaining-hostname-after-new-infrastructure/26192/6 "2015-09-18T15:13:14Z")

</div>

[QUOTE=ab;24070]I’m guessing you’re on AWS since your hostname looks similar to mind; I  
have not tried this [Jasa Seo](http://mastahh.com) out yet, just FYI:

[http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html)

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…[/QUOTE]

thanks for usefull information
