Linux IP / subnet migrations...

Changing the IP addresses / subnet will break communications with equipment unless prior arrangements are made to facilitate communications with both the old IP / subnet and new IP / subnet at the same time.

Traditionally the preferred approach is the use a secondary address on the router(s). Unfortunately it’s not always possible to use a secondary addresses on the router(s). Thankfully there is nothing that prevents the use of of a secondary address on the machine(s).

A secondary address on the router(s) is preferred because it only requires changes to be made to the router(s). Comparatively, a secondary address on the machine(s) require changes to be made to each machine, thus duplicating effort.

Secondary Addresses on the router(s)

  1. Change the primary IP address of the router(s) to be the new IP.
  2. Add the old IP to the router(s) as a secondary IP.
  3. Reconfigure the other equipment in the subnet.
  4. Remove the old secondary IP from the router(s).

Secondary Addresses on the machine(s)

  1. Change the primary IP address of the machine to be the new IP.
  2. Add the old IP to the machine as a secondary IP.
  3. Configure the kernel to use both new primary IP and old secondary IP addresses.
  4. Reconfigure the other equipment in the subnet.
  5. Remove the old secondary IP address from the machine.

Below is how you would add the secondary addresses to a Linux machine.

  1. Add the new IP to the network interface.

    ip addr add $NewIP/$NewNetmask dev $NIC
  2. Create a new routing table, if it doesn't already exist, by adding it to the /etc/iproute2/rt_tables file.

  3. Add the new subnet to the new routing table.

    ip route add $NewSubnet/$NewNetmask dev $NIC src $NewIP table new
  4. Add the new gateway to the new routing table.

    ip route add default via $NewGateway table new
  5. Optionally copy any routes from the main routing table to the new routing table as desired.

  6. Add an IP rule to activate the new routing table.

    ip rule add from $NewIP table new

$NewIP is the new maintenance IP address for the machine.
$NewNetmask is the new netmask for the machine.
$NewSubnet is the new IP network the machine is in.
$NewGateway is the new gateway IP address for the machine.
$NIC is the network interface that the new IP goes on.