ayi <p>I’m running Amazon Linux (based on RHEL5) on EC2.</p> <p>J’ai 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.</p> <p>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.</p> <p>J’ai set HOSTNAME in /etc/sysconfig/network but the DHCP hostname seems to override this.</p> <p>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?</p> <p>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.</p>
ayi_2 <p>Try this.. Edit</p> <pre><code class="lang-auto">/etc/sysconfig/network-scripts/ifcfg-eth0 </code></pre> <p>Then add</p> <pre><code class="lang-auto">DHCP_HOSTNAME=host.domain.com </code></pre> <p>See if that clears it up.</p>