Migrate instances from a network to another one

If you need to move your instance from a network to another one, you cannot simply attach the new interface to the instance, deleting the old one, because the new interface won’t be configured.

So, you can follow two different way to configure the new interface on the instance.

1. Configure the interface on the machine

Precondition: the instances is attacched to a network (e.g. default) and it has a keypair associated

  1. Attach the instance to the interface you want to migrate to.

  2. Assign a floating ip to the instance and ssh it.

  3. Click on the instance and than on the interfaces tab. Here you can see and copy the MAC Address associated to the interface.

  4. With the following command you can see the interfaces attacched to the instance. Copy the name of the interface associated to the MAC address retrieved in the previous step:

    lshw -c network | grep -e logical -e serial
    
  5. On CentOS instances, create the following file:

    /etc/sysconfig/network-scripts/ifcfg-<interface-name>
    

    and add the following content:

    BOOTPROTO=dhcp
    DEVICE=eth1
    HWADDR=fa:16:3e:c9:1f:ea
    ONBOOT=yes
    TYPE=Ethernet
    USERCTL=no
    

    You only have to modify DEVICE and HWADDR fields.

  6. Detach default interface from the instance

  7. Reboot the machine. Now the instance should be reachable from inside the network you created.

2. Recreate the instance on the right network

Precondition: the instance is attacched to a network (e.g. default)

  1. Create a snapshot of the instance you want to move

  2. Launch the snapshot just created, assigning the new network to it

  3. Delete the old instance, after checking the new one is working properly.