I like a clear naming of all the systems I manage.
Therefore I'd like to know, if it is supported to rename "localhost.localdomain". If yes, how?
Thanks
André
I noticed that if you do not have a DNS entry for the hostname, then it changes the hostname to localhost.localdom.
There is a script /opt/vmware/share/vami/vami_set_hostname, which gets run during boot. This does a rev dns lookup for the ip address as follows:
host -W 10 -T <ip> eth0
If DNS does not resolve this ip addr request, it sets the hostname to localhost.localdom
Make sure that your DNS server can resolve rev (and fwd) lookup entries for this hostname
If you cannot set up your DNS with the hostname/ipaddr of this appliance, and still want the name to persist, you can try the following steps (note this is not supported or validated by VMware) - I tried it in my test environment and it seems to work
Once you have updated /etc/hosts, /etc/hostname, /etc/sysconfig/network to your settings
cd /opt/vmware/share/vami
cp vami_set_hostname vami_set_hostname.orig
Comment out the following 4 lines in vami_set_hostname (from line 54 of the file)
cp $HOSTFILE $
.orig
.orig > $HOSTFILE
echo "127.0.0.1 $HN.$DN $HN localhost" >> $HOSTFILE
echo "$FQDN" > $HOSTNAMEFILE
This will ensure that this script does not overwrite the files everytime the appliance is rebooted.
I have the following settings in my appliance (I am not using DHCP, but have a static ip setting)
a. Update the /etc/hosts file the way you want it
127.0.0.1 localhost
<ip> <FQDN> <hostname>
b. Update /etc/hostname file with the FQDN
c. Update the /etc/sysconfig/network to change the following
HOSTNAME=<hostname>
DOMAINNAME=<domainname>
d. Update the /etc/sysconfig/network-scripts to change the following
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=<ip of appliance>
NETMASK=<netmask of appliance>
GATEWAY=<gateway ip addr>
BROADCAST=<broadcast addr>
1. Log in to the vDR appliance
2. Update /etc/hostname with the FQDN
3. Update /etc/hosts with the hostname(s) and IP addr
4. Update /etc/sysconfig/network with hostname and domainname
5. Run 'hostname -F /etc/hostname' and 'service network restart' (or just reboot)
Rupen,
thanks for your quick reply.
The steps you mentioned work, however they do not seem to be persistent.
After going through the network configuration, /etc/hostname and /etc/hosts are reset to localhost.localdomain.
It seems these settings are hardcoded somewhere. Maybe you can forward this to dev team as an EHR.
Thanks anyway
André
I noticed that if you do not have a DNS entry for the hostname, then it changes the hostname to localhost.localdom.
There is a script /opt/vmware/share/vami/vami_set_hostname, which gets run during boot. This does a rev dns lookup for the ip address as follows:
host -W 10 -T <ip> eth0
If DNS does not resolve this ip addr request, it sets the hostname to localhost.localdom
Make sure that your DNS server can resolve rev (and fwd) lookup entries for this hostname
If you cannot set up your DNS with the hostname/ipaddr of this appliance, and still want the name to persist, you can try the following steps (note this is not supported or validated by VMware) - I tried it in my test environment and it seems to work
Once you have updated /etc/hosts, /etc/hostname, /etc/sysconfig/network to your settings
cd /opt/vmware/share/vami
cp vami_set_hostname vami_set_hostname.orig
Comment out the following 4 lines in vami_set_hostname (from line 54 of the file)
cp $HOSTFILE $
.orig
.orig > $HOSTFILE
echo "127.0.0.1 $HN.$DN $HN localhost" >> $HOSTFILE
echo "$FQDN" > $HOSTNAMEFILE
This will ensure that this script does not overwrite the files everytime the appliance is rebooted.
I have the following settings in my appliance (I am not using DHCP, but have a static ip setting)
a. Update the /etc/hosts file the way you want it
127.0.0.1 localhost
<ip> <FQDN> <hostname>
b. Update /etc/hostname file with the FQDN
c. Update the /etc/sysconfig/network to change the following
HOSTNAME=<hostname>
DOMAINNAME=<domainname>
d. Update the /etc/sysconfig/network-scripts to change the following
DEVICE=eth0
BOOTPROTO=none
ONBOOT=yes
TYPE=Ethernet
IPADDR=<ip of appliance>
NETMASK=<netmask of appliance>
GATEWAY=<gateway ip addr>
BROADCAST=<broadcast addr>
Rupen,
thanks for this great support, even on saturday.
It works. However, since I am trying this in my test environment I just modified the "vami_set_hostname" and set the default "HOSTNAME=" to the FQDN I wanted. After going through the network configuration again the settings in "/etc/hosts" and /etc/hostname" were how I expected them to be. Only the "/etc/sysconfig/network" needed to be edited manually.
I appreciate your input very much. If you have the chance to talk to the developers, please ask them if it is possible to integrate the FQDN setting in their config script. I think this would be the easiest and best way to set the FQDN.
Thanks again
André
I'd recommend leaving the script alone - I'd definitly agree resetting the hostname just because it doesn't have a reverse lookup is completly nutz; so instead just set the immutable bit on /etc/hostname. chattr +i /etc/hostname. That way everything is where it should be, the script can get updated with not issues and the hostname stays staticly assigned. If you have to change it, it will be obvious that you've set it immutable.