A computer program embedded in a non-transitory computer-readable storage medium, when executed by one or more processors, for migrating a virtual machine (VM) executing on a first host on a first network to a second host on a second network, the computer program comprising:
- program instructions for assigning to the VM a VM address (VMA) belonging to a VM network when the VM is executing on the first host on the first network, wherein the AN is linked to the VM;
- program instructions for publishing a first route to an associated network (AN) via a first virtual router executing on the first host, the first network, the second network, the associated network AN, and the VM network having four different network addresses;
- program instructions for migrating the VM from the first host to the second host, the VM maintaining the VMA after the migrating;
- and
- program instructions for publishing a second route to the AN via a second virtual router executing on the second host after the start of the migrating of the VM to the second host, the first and second virtual routers having addresses belonging to the VM network, wherein the AN is still linked to the VM after migration to the second host and wherein network packets to and from the VM flow through the virtual router where the VM is executing, wherein the publishing the first and second routes comprises propagating the first and second routes via the first and second virtual routers.