Wise people learn when they can; fools learn when they must - Arthur Wellesley

Thursday, 23 February 2017

RHEL6- (7) CHANGE HOSTNAME


     RHEL6-7 CHANGE HOSTNAME:

HOW TO CHANGE HOSTNAME:RHEL6:

[root@rhel6-server ~]# hostname
rhel6-server

I need to make it client instead of server.

Temporary change:
[root@rhel6-server ~]# hostname rhel6-client1
[root@rhel6-server ~]# hostname
rhel6-client1

It will not sustain reboot.
Let’s make it persistent.

/etc/sysconfig/network

[root@rhel6-server ~]# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=rhel6-client1 çç
GATEWAY=192.168.234.2

[root@rhel6-server ~]# cat /proc/sys/kernel/hostname
rhel6-server

[root@rhel6-server ~]# echo rhel6-client1 >/proc/sys/kernel/hostname
[root@rhel6-server ~]# cat /proc/sys/kernel/hostname
rhel6-client1

[root@rhel6-server ~]# vi /etc/hosts
127.0.0.1   localhost
192.168.234.146 rhel6-client1
192.168.234.147 rhel6-client1
192.168.110.135 rhel6-client1

[root@rhel6-server ~]# service network restart

#reboot

login as: root
root@192.168.110.135's password:
Last login: Wed Feb 15 00:31:33 2017 from 192.168.110.1
[root@rhel6-client1 ~]# hostname
rhel6-client1 çç



No comments:

Post a Comment