Veeam Replication : Re-IP Linux VMs

In a series of recent posts (part1, part2 and part3) I discussed the setup of a Veeam replication job to replicate 3 Linux VMs to a remote DR site. The final step, before hand over to  was to test the DR failover functionality.

Setup

Veeam does a great job of automatically applying new IP addresses to Windows VMs, but can’t do the same with Linux VMs. So I reached out to Veeam asking for advice. I was pointed to an informative forum post http://forums.veeam.com/viewtopic.php?f=2&t=14035

The post mentions that script would attempt to ping the default gateway, and in the event of failure would swap the network configuration over to the DR IP and restart the services. So if the script CAN’T ping the gateway, apply new IP address.

After some discussion, it was decided this could lead to issues. In the event of some network issue, and the gateway couldn’t be contacted by the script then the VM could apply the DR IP address while still running in a Production environment. A big no-no in our book.

The work around for us was to change it to a more positive test, and not to use the gateway for the response, but rather a dedicated check IP address. So if the script CAN ping the check IP address, then apply new DR IP address.

The setup for the check IP address was to install a small Linux VM (DR-CHECK) in the DR environment, add a new interface and allocate a Production IP address (192.168.1.253),and connect the interface to the DR VLAN/network

NB this address can never be used in actual Production for obvious reasons

 

Veeam_Replication_DR_Check_VM

Script

 #!/bin/bash

# Ping DR bounce node

ping -c 1 -t 1 192.168.1.253 > /dev/null;

if [ $? -eq 0 ]; then

#Ping Successful so change ip address to DR network range

ifconfig eth0 192.168.1.19  netmask 255.255.255.0;

route add default gw 192.168.1.254 eth0;

else

#Cannot ping address so back in live enviroment change ip back if still set to DR

address=$(ifconfig eth0 | grep 'inet addr:' cut -d: -f2 | awk '{ print $1}')

if [ $address == "192.168.1.19" ]; then

ifconfig eth0 10.0.0.83 netmask 255.255.255.0;

route add default gw 10.0.0.254 eth0;

fi

fi

 

The script is placed in rc.local , and invoked when the VM is powered on, and carries out the following steps:-

  • Attempts to ping the ‘check’ IP address 192.168.1.253
  • If it CAN ping this address then script will know the VM is being brought up in the DR environment and apply the DR IP address 192.168.1.19 to the VM.
  • If it CAN’T ping this address then the script will know the VM is being brought up in the Production environment and apply the Production IP address 10.0.0.83 to the VM.

The use of the small Linux VM means we can add a new interface for each new set of Linux VMs to be replicated.

Overall I have to say I was very, very impressed how easy the process of setting up, configuring and running the replication with Veeam B&R 6.5 was.

3 Comments

  1. Hi,

    Great post, this is exactly what I’m looking for, to use in own production/dr site.

    I’ve included your script and changed the IP details for our setup, but it doesnt seem to work 🙁
    I’m running CentOS 5.7, Kernel is 2.6.18-238.12.1.el5 64bit.
    Any ideas?
    Thanks
    Adam

  2. Have you made sure you have another VM with the ‘check’ IP running in the same subnet on the DR side ?

Comments are closed.