1819870 Members
2390 Online
109607 Solutions
New Discussion юеВ

Changing the hostname,ip

 
Manuel Carbajal
Occasional Advisor

Changing the hostname,ip

Hi,

i have two machines that i would like to swap their hostnames and ip, what consideration do i have to know, which is the best way to do this?

Thanks in advance,

Regards,
Manuel
6 REPLIES 6
Paul R. Dittrich
Esteemed Contributor

Re: Changing the hostname,ip

Do a "man hostname" and a "man ifconfig" for the command line details.
Either pick a 3rd (unused) hostname and ip to "park" the first system while you change the second, or take them off the network until you are done with the swap.

HTH,
Paul
Balaji N
Honored Contributor

Re: Changing the hostname,ip

hi,
shutdown or pull one machine out of the network. if that is not possible, use a temporary host name and ip for it.

change host / ip for the other machine.

change host / ip for the first machine.

dont forget to update the host files and dns server for these entries if u have any. also, be aware of this change and as these might reflect in the logs as well. do u run any specific applications, firewall, etc. take care of them.

hth
-balaji
Its Always Important To Know, What People Think Of You. Then, Of Course, You Surprise Them By Giving More.
Steven E. Protter
Exalted Contributor

Re: Changing the hostname,ip

Machine 1

ifconfig eth0 (replace zero with actual value) down

Machine 2

ifconfig eth0 (replace zero with actual value) down


make permanent changes to /etc/sysconfig/network-scripts files

Then either reboot or

Machine 1
ifconfig eth0 ip_address network_mask

Machine 2
ifconfig eth0 ip_address network_mask

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Michael Steele_2
Honored Contributor

Re: Changing the hostname,ip

Why don't you just use NETCONF? Just choose manual configuration. Read the description below:


You can enter network configuration parameters in this window:
This machine's IP - enter IP number for this computer here
Network mask - enter netmask here. If omitted, mask will be calculated based on IP (which will not necessarily be right).
Broadcast address - enter network broadcast address here. If omitted broadcast address will be calculated based on IP (not mask! - which will not necessarily be right).
Default gateway - enter IP address of default network gateway (router) here.
Nameserver IP(s) - enter one or more (separated by spaces) name servers' IP addresses here. Can be omitted, but then domain names couldn't be used.
Default domain(s) - you can enter one or more (separated by spaces) domain names to search host if incomplete domain names will be used. It's optional.

http://dmacherowski.strony.wi.ps.pl/Pocket/manual.html.en.htm

Support Fatherhood - Stop Family Law
CCIL
Frequent Advisor

Re: Changing the hostname,ip

Hi there is command "set_parms" it provides various option like changing the IP address , hstname , date_time, root_passwd, etc. whne you are changing the IP address of the one machine make sure the other machine is out of network.
Amit Vichare
Steven E. Protter
Exalted Contributor

Re: Changing the hostname,ip

Wait a minute. Isn't set_parms an HP-Ux only utility.

To Author: These guys posted great answers. Why don't you give them a point or two?

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com