Post

Linux - Change Server’s Hstname

Change a server’s hostname

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
vi /etc/sysconfig/network
#add
HOSTNAME=server0.demo.local

vi /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.1	server0.demo.local
192.168.2.1     server0.demo.local
192.168.1.100     server1.demo.local
192.168.2.200     server2.demo.local


hostnamectl set-hostname server0.demo.local

systemctl restart network
This post is licensed under CC BY 4.0 by the author.

Comments powered by Disqus.