Change Hostname on SUSE SLES for SAP Installations on AWS

Change Hostname on SUSE SLES for SAP Installations on AWS

SAP systems require hostnames which aren't longer than 13 characters. The default AWS naming schema is to use the IP address separated with dashes to create hostnames. This naming schema can lead to host names with are to long for SAP installations.

The fix is based on the following assumptions:

  • The SAP system is being operated in a VPC with it's network interface
  • The IP address is a private one.
  • No DNS or NIS naming in the clients have to be used

The following procedure renames a system to node1

SLES 11

  1. Change the content of file /etc/HOSTNAME to node1. This entry will be used to set the host name in future reboots
  2. Edit the file /etc/cloud/cloud.cfg
    1. Modify the line preserve_hostname: false to preserve_hostname: true . This entry will be used in the next reboot to determine whether the hostname should be left as it is.
  3. Edit the file /etc/hosts
    1. Add node1 to the primary IP address like in this example "10.79.7.92 ip-10-79-7-92 node1"
  4. Set the host name with the command "# hostname node1". This command performs a dynamic change. It's effect will not last beyond a reboot.
  5. Configure the DHCP client not to configure the hostname
    1. Enter the command yast lan
    2. Move to entry Hostname/DNS (<tab> <arrow right>) and select it
    3. set hostname to node1 in the host name field
    4. deselect (remove x) from the entry set hostname dynamically
    5. Save all settings and leave yast

SLES 12 & SLES 15

  1. Edit the file /etc/cloud/cloud.cfg
    • Modify the line preserve_hostname: false to preserve_hostname: true . This entry will be used in the next reboot to determine whether the hostname should be left as it is.
  2. Edit the file /etc/hosts
    • Add node1 to the primary IP address like in this example "10.79.7.92 ip-10-79-7-92 node1"
  3. Use command:
    • $ hostnamectl set-hostname node1

 

Stefan Schneider Tue, 12/09/2014 - 11:35