By default, the host name of your computer is not set. The Sharing panel allows you to specify a computer name that is an attribute of Mac OS X. My theory is that if the host name is not set, hostname (and your shell prompt) will use this value instead. Below is the output of scutil and hostname on my laptop.
patikoija ~ % scutil --get ComputerName patikoija patikoija ~ % scutil --get LocalHostName patikoija patikoija ~ % scutil --get HostName HostName: not set patikoija ~ % hostname patikoija.local
When I am in my companyβs office, my hostname is also set to what begins with βdhcp-β. I assume that the DHCP server sets the actual host name, and when scutil starts, that name will be displayed. You can try using scutil to set the true hostname of your computer and see if this supports "resistance" to the DHCP server to override it.
chepner
source share