I'm running Amazon Linux (based on RHEL5) on EC2.
I have my own domain name pointing to the instance's elastic IP. Amazon auto-assigns the instance a generic (and not visible on the Internet) hostname via DHCP.
This internal-only hostname breaks sending email since the SMTP server wants to see a real (and public) hostname. I can fix email by manually running the "hostname" command to set the real public hostname.
I have set HOSTNAME in /etc/sysconfig/network but the DHCP hostname seems to override this.
Is there a good/correct way to set my hostname and always ignore what DHCP has to say about it, while still using DHCP otherwise?
I can think of lots of kludgy stuff to do (run a script that undoes what DHCP does, or whatever) but wondering if there's an actual config setting somewhere to force the hostname.