-1

This question already has an answer here:

First, what is the correct way to change the hostname in Linux ? I followed some steps on the internet and sometimes it does not take effect. Besides, the new hostname does not appear when I ping my PC from another one on the same LAN. So how to change the host name and make it appear on the LAN ?

marked as duplicate by Gilles, jasonwryan, John WH Smith, Anthon, slm Mar 6 '15 at 0:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    When asking on the SE sites, you need to tell us what you did and how it failed. "I followed some steps on the internet and sometimes it does not take effect." is really not very useful. Please edit your question, tell us what you did and exactly how it failed and also explain how your LAN is set up. Do you have a local DNS server that can resolve IPs to hostnames? – terdon Mar 5 '15 at 15:07
0

Just edit the hosts file, and put the name of the machine in there.

# vim /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1          {hostname of your machine} localhost.localdomain localhost
::1                localhost6.localdomain6 localhost6

If you don't know the name of the host, then type: uname -a

  • 1
    That won't have any effect on other machines though. – Gilles Mar 5 '15 at 22:48
  • Ok, thanks for that @Gilles. I have had to do these steps on my Virtual Machine (CentOS), and then was able to ping the machine from my own local machine (Windows), and see the name of the VM. – Kevdog777 Mar 6 '15 at 8:45

Not the answer you're looking for? Browse other questions tagged or ask your own question.