Os X uses complex auto-magic to set the host name:
- The name provided by the DHCP or BootP server for the primary IP address
- The first name returned by a reverse DNS (address-to-name) query for the primary IP address
- The local hostname (set in the Sharing pane of System Preferences)
- The name localhost
The following post provides different fixes for OS X 10.5 & 10.6+: How can I stop Mac OS X overriding my hostname when I receive a DHCP request on Snow Leopard?How can I stop Mac OS X overriding my hostname when I receive a DHCP request on Snow Leopard?