I'm using CentOS 7 x86_64 and I like to change my hostname and ping it in local network via its name and not IP. I used below command:
Code: Select all
$ hostnamectl
Static hostname: myserver
Icon name: computer-server
Chassis: server
Machine ID: cf7fd176d7894138b9408e80946cf0d5
Boot ID: f76da434640d43029548b3b70d676fd6
Operating System: CentOS Linux 7 (Core)
CPE OS Name: cpe:/o:centos:centos:7
Kernel: Linux 3.10.0-327.el7.x86_64
Architecture: x86-64
Code: Select all
$ ping myserver
ping: unknown host myserver
Code: Select all
$ cat /etc/hosts
127.0.0.1 myserver
Thank you.