VPS Migration with OSPF
This article presents how to be able to migrate a container between different subnets in the network by using a dynamic routing protocol such as OSPF. An already working OSPF setup is mandatory, this article only shows the OpenVZ specifics.
Install the Quagga routing suite available on the official website. For many distributions, a prebuilt package is available:
apt-get install quagga
yum install quagga
In /etc/quagga/zebra.conf just put a password to be able to access the telnet interface.
In /etc/quagga/ospfd.conf configure the OSPF network and area in which is OpenVZ server will be and configure the redistribution of routes generated by the container.
password zebra ! router ospf redistribute kernel route-map only-ve network YOUR_NETWORK/XX area 0.0.0.0 ! route-map only-ve permit 10 match interface venet0 ! line vty
Once your OpenVZ server takes part in the OSPF network, you can easily use the ‘vzmigrate’ command to migrate a container between different subnet of the network and the IP of the container will be redistributed in the whole network as a /32 (host route).
To avoid problems with this setup the IP addresses of your container must be taken outside of any other subnet configured on your network. If the IP address of the container is taken from an actual subnet, the other hosts of the subnet won't be able to communicate with it, except if you use proxy arp on the router.