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.


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

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 (,and connect the interface to the DR VLAN/network

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





# Ping DR bounce node

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

if [ $? -eq 0 ]; then

#Ping Successful so change ip address to DR network range

ifconfig eth0  netmask;

route add default gw eth0;


#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 == "" ]; then

ifconfig eth0 netmask;

route add default gw eth0;




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
  • 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 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 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.


  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?

  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.