I'm a windows user mainly so sorry if this is so easy...
In windows I can specify a host name in the host file, so I can make 127.0.0.1 = my.hostname.com
Hondy, it varies a little bit by the distribution...
First, a concept.
127.0.0.1 is always 'localhost'. You can add more name references (hostnames) to it, but your best behavior talking with other linux/unix folk is to call your local machine 'localhost'. Obviously if it's also known as mail.example.com to other machines then you have that to use as well.
Now, on RedHat based systems (Redhat, Fedora, Centos, etc) there are two methods.
1) You can change the hostname immediately by using the 'hostname [mail.example.com]' command. This will immediately change the name the machine calls itself in the command prompt. However, this change is temporary and would be lost on reboot.
2) You can also edit the configuration file in /etc/sysconfig/network and change the "HOSTNAME" value. This value will NOT take effect when you edit the file, but it will be used and persist each time you reboot or restart your network services.
Doing a combination of 1 & 2 is the best way to assure you're making the change (1) immediately and (2) with persistence after reboots.
However, this is ignoring DNS which allows other machines to find your machine by this new name. That's another topic.
D.E.R. Management - IT Project Management Consulting
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.