Use local DNS name and IP from DHCP

For Red Hat Linux if you receive your IP address from a DHCP server, you may update the local DNS name by adding the following line to the correct ifcfg file in /etc/sysconfig/network-scripts, such as ifcfg-eth0 or ifcfg-eth1:

DHCP_HOSTNAME="myhostname.example.com"

If you are running Debian, edit /etc/network/interfaces as follows (adding the hostname line)

iface eth0 inet dhcp
    hostname mybox.mydomain.com

This is useful when your IP-address resolves to more than one hostname.