Veeam – Re-visit Linux Re-IP

I wrote a blog post back in 2013 , //, on how to Re-IP Linux VMs. This week I have been working on the same thing , for a customer’s DR replication and I’ve come across a couple of improvements/changes that can be made to make the process a little easier.

Script Update

So the 1st thing I came across is a missing ‘|’ and some funky issue with inverted commas/apostrophes , this may have been a typo or a formatting issue with the cut and paste, so here is the updated script

#Ping DR bounce node
ping -c 1 -tย  1 > /dev/dull;
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 environment 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;

Linux Re-IP script - bash view


In the original post I hadn’t mentioned the location of rc.local , this is located in /etc/

While dealing with the customer setup, for some unknown reason I had been placing the link to the script in /etc/rc3.d , however the VM in question was using run level 2, you can check this by performing :-

cragdoo@linuxtest:~$ runlevel

N 2


So placing it in /etc/rc3.d isn’t going to work ๐Ÿ™

/etc/rc.local is a better place to put the link, as it gives all the networking services a chance to start up, to allow the script to successfully ping the DR IP โ€ฆor not

A quick(ish) update post , for my own sanity rather informational ๐Ÿ™‚