Monday, August 29, 2011

Linux Hostname Change - no restart required!!!



Linux Hostname Change - no restart required!!!



login as: root
Access denied
root@172.21.18.103's password:
Last login: Mon Aug 29 12:32:52 2011 from 172.21.21.2
[root@wip ~]# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=XXXX
[root@wip ~]# cp /etc/sysconfig/network /etc/sysconfig/network.orig
[root@wip ~]# hostname
XXXX
[root@wip ~]# vi /etc/sysconfig/network
[root@wip ~]# hostname
XXXX
[root@wip ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost
172.21.18.103 XXXX
172.21.19.16    lpar07f5p
172.21.19.221   sap720
172.21.19.15    sapapp780
[root@wip ~]# cp /etc/hosts /etc/hosts.orig
[root@wip ~]# vi /etc/hosts
Replace XXXX with YYYY
[root@wip ~]# hostname
XXXX
[root@wip ~]# hostname YYYY
[root@wip ~]# hostname
YYYY
[root@wip ~]# service network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
[root@wip ~]# hostname
YYYY
[root@wip ~]#

No comments:

Post a Comment