-1

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 ?

3bdalla
  • 441
  • 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 05 '15 at 15:07

1 Answers1

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

Kevdog777
  • 3,224