Notice! This document is currently in Archived status.
The content of this document may be incorrect or outdated.

Print this article Edit this article

Moving an ECN *nix host

WARNING: DEPRECATED DOCUMENT

you want this, instead:

https://engineering.purdue.edu/ECN/Support/KB/Docs/ecn-supported-linux-rename-procedure?_authenticator=e99bfc8447a7927ade905a0028cb51faa4bfd790

How to Move an ECN UNIX / Linux Host

This article details what steps should be taken to move an ECN supported Linux / UNIX host. This document applies to both ECN RHEL5 and Sun hosts. Steps are the same for either OS unless specifically noted.

Whether a machine is moving subnets or just needs a new IP address in the same subnet, or is getting a new host name, there are a few steps that must be taken to ensure this happens properly on all aspects of the network.

SCENARIO 1: The host is receiving a new IP address

The ECN supported machine computer.ecn.purdue.edu is receiving a new IP address. The address will change from 128.46.x.y to 128.46.q.z. The host name is staying computer.ecn.purdue.edu.

Step 1: Register the new IP address on Harbor

  • On harbor as root, go to ~nettable/masters.
  • Check out and lock the file localhosts-ecn.txt.
# cd ~nettable/masters
# rcedit localhosts-ecn.txt
  • Edit the file to reflect the new IP address of the host by adding a new line in the file.
    • The file is kept in numerical order by IP address of the host
    • Don't forget to make sure the new IP address of the host is not already taken
    • Don't forget to delete the old entry
  • When you change the IP address of your mahcine, please make sure the new entry is placed in the appropriate spot in the file.
  • The format for the localhosts-ecn.txt file is:
IP Address <tab> full.host.name <tab> # Hardware-Platform Operating-System
  • A sample entry from the file might look like:
128.46.x.y computer.ecn.purdue.edu	# IBM-PC Linux
  • When you've made your edits, check in and ulock the file
    • Don't forget to provide a short description of what you changed.
    • The last line of your edit should just be a period ( . ) so RCS can finish checking the file back in.
enter log message, terminated with single '.' or end of file:
>> changed IP address for computer.ecn from 128.46.x.y to
>> 128.46.q.z -ECNuser
>> .
done
  • At 4:45 p.m. a coron job will run on Harbor to generate and install new name server and host name files.
    • These files will be propagated overnight via RDIST to the ECN supported *nix hosts.
    • The new IP addresses will then become active.

Step 2 (for Linux): Changing the IP address on the host

  • Log into the host as root and navigate to /etc/sysconfig
    • Edit the network file to reflect the changes
    • The default gateway should be set to that of the subnet of the new IP address (this is not an RCS file)
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=computer.ecn.purdue.edu
GATEWAY=128.46.q.1
  • Step down one directory and edit the ifcfg-eth0 script to reflect the new IP address (not an RCS file)
#  Broadcom Corporation NetXtreme BCM5751 Gigabit Ethernet PCI 			Express

DEVICE=eth0
BOOTPROTO=static
DHCPCLASS=
HWADDR=00:14:22:5E:A2:82
IPADDR=128.46.q.z
ONBOOT=yes
  • You can now shut down the machine and move it to its new location if necessary. When it boots back up it will have the correct IP addressing and routing information.
  • The machine must be re-registered with RHN (the Red Hat Network) with the following command:
# rhnreg --activationkey=<key>
  • If the command fails, the machine is already registered, so you will n eed to add the --force option
  • The key is availabe on harbor:/var/local/install_rh5/clients/ecnfirstboot.sh.
  • The old machine should be de-registered from RHN by sending an email to linxu@ecn with a request to do so.

Step 2 (for Solaris): Changing the IP address on the host

Please note - this requires the host to be down overnight so RDIST can send the appropriate files out to all of the servers.

  • Log into the host as root and edit the /etc/hosts file to reflect the IP address change for computer.ecn.
    • You can just edit the file the machine name is already on; no need to move the line or create a new one.
    • This will look almost exactly like editing localhosts-ecn.txt in Step 1.
  • Shut the computer down overnight. If it is changing locations it can be moved.
  • The next day, once IGOR and RDIST have run, turn the computer on and it will have the new IP address active.

Step 3: Generate new SSH keys

  • On harbor as root.
  • Run the command get-ssh-keys <hostname> where <hostname> is the computer the IP address has been changed for.
    • This script will retrieve the public keys from the host and include them in /etc/.ssh/ssh_known_hosts.
    • The keys will be completely distributed via IGOR and RDIST overnight.

Scenario 2: The host is receiving a new name

The ECN supported machine computer.ecn.purdue.edu is changing its hostname to fileserver.ecn.purdue.edu. The IP address has already been changed to 128.46.q.z per the steps above. If there is no IP address change, you can just start here.

IMPORTANT: Before proceeding with a host name change, please go to the ECN Backups List and search for the name of the host to receive the name change. If the host is listed as on backups, email backup@ecn for more details, stating the computer name and what the name will be changing to. The backup staff can provide you with more details. If you have any doubts, email backup@ecn before continuting.

Step 1: Register the new host name on Harbor

  • On Harbor as root, navigate to ~nettable/masters
  • Check out and lock the localhosts-ecn.txt file
# cd ~nettable/masters
# rcsedit localhosts-ecn.txt
  • Edit the file to reflect the new name of the host by simply adding a new line in the correct format.
    • The file is kept in numerical order of IP address of the host
    • Don't forget to make sure the new name of the machine is not already in use.
    • Do not remove the old entry, as it is needed by ACmaint for a bit yet.
      • The new host name should be assigned the IP address of the current host name.
      • The current host name should be assigned a "dummy" IP address until ACmaint has completed its necessary functions.
      • Send an email to ACmaint informing them of this change.
  • The format of the localhosts-ecn.txt file is:
IP Address <tab> full.host.name <tab> # Hardware-Platform Operating-System
  • Changing the host name will look something like this in the file:
128.46.q.f computer.ecn.purdue.edu	# IBM-PC Linux

[.... file text ....]

128.46.q.z fileserver.ecn.purdue.edu # IBM-PC Linux
  • When you've made your edits, check in and unlock the file
    • Don't forget to provide a short description of what you changed.
    • The last line of your entry should be a period ( . ) so RCS can finish checking the file in.
enter log message, terminated with single '.' or end of file:
>> changed host name for 128.46.q.z from computer.ecn
>> to fileserver.ecn. -ECNuser
>> .
done
  • At 4:45 p.m. a cron job will run on Harbor to generate and install new name server and host name files.
    • These files will propagate overnight through RDIST to all ECN supported *nix hosts.
    • The new host name will become active at this time.
  • Important: If you have not already, you must send an email to ACmaint informing them of the host name change, including both host names and both IP addresses, which is the new name, and which is the old name. Do not continue without doing this.
    • The ACmaint staff will edit all files appropriately once the name change is complete from their end of things.

Step 2 (for Linux): Changing the host name on the host.

  • Lost into the host as root and change to the /etc/sysconfig/ directory to edit the network file.
    • Change the HOSTNAME field to reflect the new name of the system.
    • In addition, run the command hostname <new name> to ensure the change effectively propagates on the local system.
# rcsedit localhosts-ecn.txt
enter log message, terminated with single '.' or end of file:
>> changed host name for 128.46.q.z from computer.ecn
>> to fileserver.ecn. -ECNuser
>> .
done
  • At 4:45 p.m., a cron job will run on Harbor to generate and install new name server and host name files.
    • They will be propagated overnight to all ECN supported *nix hosts via RDIST
    • Thy new host name will become active at that point in time
  • IMPORTANT: If you have not already emailed acmaint@ecn stating the name change that neesd to take place, DO SO IMMEDIATELY before proceeding with the rest of the steps in this process.
    • ACmaint will remove the old host name once all necessary steps within the ACmaint processes have been performed. DO NOT REMOVE THE OLD HOST NAME.

Step 2 (for Linux): Changing the host name on the host

  • Log intothe host as root and navigate to /etc/sysconfig to edit the network file.
    • Change the HOSTNAME field to reflect the name change
    • In addition, run the command hostname <new name> to ensure the name change propagates within the local system successfully.
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=fileserver.ecn.purdue.edu
GATEWAY=128.46.q.1
  • You can now shut the machine down and move it to its new location (if necessary). When it boots up it will have the correct host name.
  • This is the only change that is needed on the host, and it does not have to be shut down for the change to take effect.

Step 2 (for Solaris): Changing the name on the host

Please note - this requires the host to be down over night so RDIST can properly distribute the files across the network

  • Log into the host as root and edit the /etc/hosts file to reflect the name change of the machine.
    • You can simply edit the line the host is already on; no need to make a new line
    • This will look almost exactly like editing the localhosts-ecn.txt file from earlier.
  • Also within /etc/, edit hostname.*, nodename, and defaultdomain with the new host name.
    • Just as a precaution, grep for the host name through the rest of /etc/ just to make sure there are no other files relying on the host name
  • Shut the computer down over night. If it needs to move locations, now is the time to do so.
    • Important: Double check that you have emailed acmaint about the host name change.
  • The next day, once IGOR and RDIST have synchronized the network, the host can be turned back on, and it will have the correct host name.

Step 3: Changing IGOR

  • On Harbor as root, navigate to /usr/share/adm/igor/hosts and find the file that contains the old host name
    • Check out and lock the file to edit it
# grep computer *
sitefile:@if HOSTNAME == "computer"

# co -l sitefile
  • Edit the file by simply replacing the old host name with the new one.
    • You might have to page through the file.
    • Look out for similarly named machines -- Make sure you're changing the right one!
    • The host may or may not be in with a series of other host names of the same configuration. Changing the host name will not affect the configuration of the other hosts.
  • Check the file back in and note the changes
@if HOSTNAME == “machine 1” || HOSTNAME == "fileserver"
@ define ACMAINT3
@ define HOMESERVER
@ define NTPHOST
@ define SITE "sitename"
@ define SITEBIN "site"
@endif

Step 4: Changing RDIST

  • On Harbor as root, navigate to /var/ridst/hosts
  • Find the file that contains the old host name, and check out and lock the file.
    • Edit the file by replacing the old host name with the new one
    • This file contains information for Solaris and Linux hosts, and is organized by operating system type.
    • The host names are separated by white spaces.
  • Check the file back in and note the changes
#
# Host Type Description
#
OS_Distro_And_Host_Type = (
machine1 server1 server2
bigcomputer fileserver
smallcomputer terminal usrterm
)

Step 5: Changing Netgroups

  • Log into harbor as root and navigate to /usr/share/adm/config/os/common
  • Search for the host name in the file named "netgroup".
  • If the host appears in a file, check out the file to edit it by replacing the old host name with the new one.

Step 6: Updating EGAD

  • EGAD is the ECN General Asset Database. It must be updated whenever a host changes names or moves locations.
  • Log into the EGAD Web Interface with your non-administrative ECN credentials.
    • Enter the machine name you're looking for in the search box and select "Machines" from the drop down menu.
    • Click on the name of the machine to edit the entry.
    • Enter as much information about the machine as you can, then click "update".
  • At very least, the machine name and if necessary the location should be updated.
  • EGAD should be kept as up to date as possible, as it is the only way the support staff has of knowing where exactly a machine is located should it require maintenance that can not be performed remotely.

Step 7: Register with the Red Hat Network

  • The machine must be registered with the Red Hat Network using the following command:
[root@fileserver ~]# rhnreg --activationkey=<key>
  • if the command fails, the machine is already registered, so you will need to add the --force option.
  • The activation key is available on harbor:/var/local/install_rh5/clients/ecnfirstboot.sh.
  • The old machine should be de-registered from the Red Hat Network by sending a request to linux@ecn

Step 8: Generate new SSH keys

  • On Harbor as root, once the DNS files have synchronized
  • Run the command get-ssh-keys <host name> where host name is the new name of the machine.
    • this script will retrieve the public keys from the host and include them in /etc/.ssh/ssh_known_hosts.
    • The keys will completely distribute through IGOR and RDIST

Last Modified: Jan 3, 2023 2:10 pm US/Eastern
Created: May 6, 2010 1:22 pm GMT-4 by admin
JumpURL: