The hostname can be changed dynamically by routers and other network devices through DHCP requests, which can have the hostname keep changing every time your IP address and other DHCP information is renewed. If this is the case, you may be able to set the router to never provide hostname information, or you can set the computer to never accept a hostname change. To do this, you will need to add a line to the computer's hostconfig file using the following procedure:
Open the Terminal
Enter the following command:
sudo pico /etc/hostconfig
Authenticate, scroll to the bottom of the file, and add the following line:
HOSTNAME=Tophers-Desktop
(Change "Tophers-Desktop" to your desired hostname--no spaces)
Save the file and quit by pressing control-X, confirming the save with the "Y" key followed by "enter".