Configuration of OVH IP Failover on VMs

Background
I have had a server with OVH for the past several years, and one of the things that took me many months of research, as well as trial and error, to get right was my IP address configuration for virtual machines.  The documentation available from OVH has been consistently lacking these past few years on how to properly configure it.

Debian \ Ubuntu systems will add to the complications, because they do not agree with the necessary configuration.  If you try to add it traditionally, just by editing /etc/network/interfaces, you will most likely end up with no default gateway when you’re all said and done, and your connection still won’t work.

For the first few months I was with OVH, I was launching my networking through a shell script in a cron job, because configuring it with /etc/network/interfaces just didn’t seem possible.

 

What You Need For This Guide \ Assumptions About Your Setup
1. A dedicated server on the OVH network.  This guide has been tested in the Roubaix datacenter  and the Gravelines datacenter, but OVH uses the same schema in Montreal as far as I know.
2. A virtualization platform installed, and a virtual switch bridged with your network interface.  I have been using VMWare, and a vSwitch bridged with my eth0 interface.  This guide should be applicable to any virtualization suite (Xen, OpenVZ, etc) as long as your networking is bridged.
3. A Debian \ Ubuntu VM.  You can apply the knowledge gained from this guide to other operating systems (eg. CentOS) but the configuration will be different as the files are located in different places and are parsed differently.
4. A purchased IP range.  You can purchase IP addresses from OVH in your Manager Panel.

 

Gather Your Information \ Initial Setup On OVH Side
1. Your dedicated server’s Main IP will be needed for this guide.   Say, for example, your main IP is 123.4.5.67.
2. Your dedicated server’s Gateway IP will be needed for this guide.  On the OVH network, this is the first three octets of your main IP, ending in 254.  For 123.4.5.67, the gateway is 123.4.5.254.
3. A Fail Over IP Range registered with OVH.  You can register any size IP block, and you can pick any IP from the block.  Say for example, you bought 5.6.77.8/29.  All of the Fail Over IPs are usable at OVH, so you have available all 8 IPs from 5.6.77.8 to 5.6.77.15 for use for your VMs.  You can purchase an IP block from your Manager Panel.
4. A Registered VM MAC Address associated on OVH’s routers.  Without this step, your connection will not work.  You can register VM MACs in your Manager Panel.

 

How To Register A VM MAC Address
In the new OVH Manager panel, you can register a VM MAC address by going to the “Manage IPs” page, clicking the gear icon next to the IP(s) you want to assign to the VM, and clicking “Add A Virtual MAC”.  You can choose an existing MAC address if you are assigning more than 1 IP, otherwise OVH will assign a new MAC address to you, and you will edit your VM preferences so your network interface has this MAC address.  Make sure you select the MAC address type “VMWare” if you are using a VMWare server, as this will generate MAC addresses which VMWare will accept.  You can use type “OVH” for any other virtualization platform.  The “name of virtual machine” field is just for your notes, and can be anything.

 

Operating System Installation
Install Debian \ Ubuntu to the VM, from a full install media.  Do not plan on doing a network install, as this guide does not cover how to make the OVH networking functional during installation; only after installation.  Skip the step for setting up networking during the installer, leave it unconfigured.

 

Setting Up /etc/network/interfaces
Now that you have your operating system installed, you are ready to configure your /etc/network/interfaces file.  This guide assumes that eth0 is your Internet interface. I will use IP addresses from the example above under “Gather Your Information”.  Do not use these addresses, substitute your own IP addresses.

A few things to note, for anyone asking any technical questions about what I just did above:

  • You should choose 1 IP address from your IP block.  If you want to add more, see the further instructions below.  This IP is the Main IP of your VM.
  • Regardless of the size of your block, you will treat the IP address as a /32 with a netmask 255.255.255.255.
  • Because you are using a /32, the network\broadcast IP is your IP.
  • Your default gateway should be the same as your dedicated server’s default gateway.  DO NOT try to use what should logically be the gateway IP for your IP block, and DO NOT try to set your dedicated server itself as the gateway.  The IP block is irrelevant, the gateway is always the dedicated server’s gateway IP.
  • The routes have to be added this way, because the configuration is not valid.  The gateway should not be reachable from this network range, because it’s a /32.  However, the gateway will be reachable anyway, and adding the routes this way should work.

 

DNS Resolution
You will also need to edit your /etc/resolv.conf to put a DNS name server in there, otherwise your server will be able to ping other IPs, but it will not be able to resolve DNS.  You can just put a line in there, like this line which uses the public OpenDNS resolver:

 

Want To Add More IPs?
Sometimes it is desirable to have more than one IP address on your server.  You can easily add additional IPs from any IP block as an alias IP.  You don’t need to configure any additional gateways, because the gateway is always your dedicated server gateway.  You can purchase as many IP blocks as you want, and assign them all this way, it doesn’t matter if they are totally different IP ranges.  In the example below, I will add 2 additional IPs from the IP range I used as an example, 5.6.77.8/29.

 

Having Problems?
If you are having any problems, please review these items:

  • First, reboot the VM to ensure that all of the networking changes you made are fully applied.
  • Can you ping your default gateway?  If not, did your route persist?  Run “route -n” and see if the route is there.  If it isn’t there, try adding it manually by running the commands in the post-up in /etc/network/interfaces.  See if you get any errors.
  • Did you configure DNS?  Try pinging just an IP address, (eg. ping 4.2.2.1) and see if you get any response.
  • Did you remember to register a MAC address, and did you change the MAC address for the VM?  Run “ifconfig eth0” and make sure the MAC address shown matches what’s registered in your OVH Manager Panel.

 

Need Further Assistance?
As always, feel free to leave a comment below if you need any assistance.  I will be happy to help!

50 Thoughts on “Configuration of OVH IP Failover on VMs

  1. Thank you, it helped me, it’s the one article that i found about configuration ip failover.
    I’m waiting for more 😉

  2. Kirk Schnable Kirk Schnable on September 16, 2014 at 2:43 PM said:

    Hello Alexis,

    I am glad to hear that this was helpful to you! I know I wish I had found a guide like this when I was trying to figure out how to configure my VM IPs at OVH. That’s why I posted it. 🙂

  3. Thank you as well, I found this very useful for my purposes today, and also for those wishing to get networking working within the installer, the lines below may help (I used the same IP format as above):

    ~ # ip link set eth0 up
    ~ # ip -4 route add 123.4.5.254 dev eth0
    ~ # ip -4 route add default via 123.4.5.254 dev eth0
    ~ # ip -4 addr add 5.6.77.8 brd 5.6.77.8 dev eth0
    ~ # ip link set dev eth0 address xx:xx:xx:xx:xx:xx

    (first line may not be needed)

    The installer gives you an option to drop to a shell temporarily where we can run those commands, however you need to let it try to setup networking anyway, and then elect not to setup networking at this time – if you don’t, it will wipe out any networking configuration during its auto-configuration attempt.

    Don’t forget to edit resolv.conf with your nameserver, the jessie installer at least has your favorite editor most likely, then just ‘exit’ from the shell and continue with mirror selection.


    Bryan

  4. I was going mad and couldn’t understand why I could route traffic. Thank you very much for sharing this information.

  5. Chandramouli. N on January 29, 2015 at 3:37 AM said:

    Hi,

    Please suggest the procedure to access the VM to install Operating system in VM, after registering VM MAC Address.
    Thank you.

    • Kirk Schnable Kirk Schnable on February 11, 2015 at 10:24 AM said:

      Hello,

      Typically this would be done through the hypervisor, because you would need to configure the IP address after OS install before any network access to the VM directly would be possible.

      This would depend on what hypervisor you were using, for example if you were using VMWare ESXi, you would access the VM console using the vSphere client.

      Does this answer your issue?

    • You can access the VM via VNC even it doesnt have any ip address yet. Open up a putty ssh connection to your XenServer. Once you have done that, read this article and you are good to go: http://support.citrix.com/article/ctx119906

  6. How did you add the media to your xen server to install the vm please? “Install Debian \ Ubuntu to the VM, from a full install media.”

    • John satman on March 1, 2015 at 8:15 AM said:

      sorted media transfer used WinSCP with xenserver 6.5 and installed vm debian whezy OS

      Also network issue when using a vm with cardproxy server on a debian OS it will not connect to another VSP server with a different host and so reverting to use IPv6 for each vm. I will report back if this solves this issue

  7. Hi,

    In order to get net install to work, right after the installer says that cant fetch anything, do the following:

    Execute a shell -> modprobe e1000 -> exit the shell and do the network config again.

    You can also do it the manual way by typing ip addr add xxx.xxx.xxx.xxx/24 dev eth0, but that’s another story.

  8. James on July 17, 2015 at 12:50 PM said:

    so after 3 hours or so, i finally found this page, it totally saved my day. thank you !!!

  9. Hi Binary Impulse,
    Myself Yours Visitor I need help – I have windows dedicated server:
    IP : 1**.***.***.** [Hidden] we will mention it as: MAIN.IP.ADD.RESS

    I access above IP address via RDP with username: root
    Server have Microsoft Windows Server 2012 Standard Edition installed and Licensed copy. License ID: windows-ca-HIDDEN
    =============================

    I want to use my server at the same time on 2 different machines with 2 different IPs access via RDP [Remote Desktop Connection] so, I just created:

    New user account with administrator access on server:

    Username is: NewUserAccount

    Now, I ordered new IP address with payment of $3 for it’s setup and I selected Canada IP address location.. I got following IP address added to my dedicated server:

    New.IP.ADD.RESS

    Now, I have 2 machines/PC [one is my home PC and my employee PC: NewUserAccount]

    I want to access dedicated server with:
    IP Address: MAIN.IP.ADD.RESS
    – User name: root and password: HIDDEN

    I want my employee NewUserAccount to access same windows dedicated server from his machine/PC RDP [remote desktop connection] with following details:
    IP Address: New.IP.ADD.RESS
    – User name: NewUserAccount

    I added new IP to server with $3 OVH IP setup fees.. I created new username on server with administrator rights and I try to connect to new IP Address: New.IP.ADD.RESS and with – User name: NewUserAccount

    but I get following error: here is screenshot image URL of error:

    http://s9.postimg.org/izxgqpnb1/error_OVH_2.jpg

    Can you please help me get this fixed? I want to use same server with me and my employee with different IP address and Username passwords so, we both can work.

    I will appreciate yours help!
    Regards,
    Yours Visitor

  10. Thanks so much its helped me – also, support team shared this link with me:

    http://docs.ovh.ca/en/guides-network-ipaliasing.html#windows-2008-2012-server

    Both yours and support team links are very helpful! appreciated Kirk!!!

    Regards!

  11. AutoJukebox on October 9, 2015 at 9:24 PM said:

    My interfaces file has lo instead of eth0.. What do i do?

    • Kirk Schnable Kirk Schnable on October 10, 2015 at 2:11 AM said:

      Hello,

      lo is an interface on every machine, it is the loopback interface and the interface holding the IP “127.0.0.1”.

      Do not modify the lo interface settings, that may cause unexpected results.

      Instead your should add interface information for your eth0 interface. If you can give me the distro you’re running I can give you more specific advice on how to do that.

  12. Hi Guys,

    I am having issue with OVH about assigning the IP to one virtual machine . this VM is on VMware ESXI 5.5

    I have a IP pool of /29 but I am not able to assign any ip .

    I used OVH guide for bridging but not working

    anyone can help
    and give me step by step guide for debian

    • Kirk Schnable Kirk Schnable on January 25, 2016 at 6:57 PM said:

      Hello,

      The guide I posted above should be working for Debian.

      Can you please post your /etc/network/interfaces file from the VM where the network is not working?

      If possible also paste the output of “ip addr show” and “route -n”.

      Thanks,
      Kirk

  13. Carlos Cabral on January 31, 2016 at 8:28 AM said:

    Hi Kirk, I’m trying to add an IP failover on a dedicated server, I don’t have any VM’s – do your instructions also apply? What should I do differently?

    I followed OVH guides, two different approaches (static config and up/down hooks) but with no success.

    here’s my /etc/network/interfaces file:

    auto lo
    iface lo inet loopback

    auto eth1
    iface eth1 inet static
    address MYIP.XXX
    netmask 255.255.255.0
    network MYIP.0
    broadcast MYIP.255
    gateway MYIP.254

    auto eth1:0
    iface eth1:0 inet static
    address FAILOVERIP
    netmask 255.255.255.255
    broadcast FAILOVERIP

    #post-up /sbin/ifconfig eth1:0 FAILOVERIP netmask 255.255.255.255 broadcast FAILOVERIP
    #post-down /sbin/ifconfig eth1:0 down

    iface eth1 inet6 static
    address IPV6IP::
    netmask 64
    post-up /sbin/ip -family inet6 route add IPV6IPff:ff:ff:ff:ff dev eth1
    post-up /sbin/ip -family inet6 route add default via IPV6IPff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del default via IPV6IPff:ff:ff:ff:ff
    pre-down /sbin/ip -family inet6 route del IPV6IPff:ff:ff:ff:ff dev eth1

    • Kirk Schnable Kirk Schnable on February 2, 2016 at 2:29 AM said:

      Hello Carlos,

      So, based on what you’ve posted it looks like your dedicated server’s primary IP address and route are working properly, but you’re not able to get the alias IP addresses working?

      What you posted for the alias interface eth0:1, I believe should be correct. I see no reason why this would not work on the dedicated server itself, although I’ve never tried it.

      Have you tried registering your dedicated server’s MAC address on the fail-over IPs? I do not think the IP addresses will be usable until a MAC address is registered to them in the portal.

      If you did get it working (I apologize it took two days for me to get back to your comment), please let me know what was wrong, I am very curious!

  14. ABSOLUTLY BRILLIANT UP AND ONLINE IN 5 MINS EASY JUST AS IT SAYS ON THE TIN

  15. I see that you’re still responding to comments on here. I’m wondering, would you some time in the near future, be willing to help me out with trying to figure out what’s being done wrong on my server via email (or an instant messaging platform).

    Currently trying to get networking down for ubuntu 14.04.4 lts 64 bit with esxi 5.5 as the hypervisor. I’ve gotten the networking down for windows but now that I’m trying to start messing around with linux, it’s just not having it :p

    I’ve tried a few different guides, this time, ovh.com/bridgeClient, this one http://montecarlo-computing.com/blog/Ubuntu-VM-installation-on-OVH-hosted-ESXI-dedicated-server (it even does the exact printout of netstat -rn it says it should, so I’m following those instructions correctly, but still can’t even ping an ip directly), and a few others. Thanks either way, and no worries about a quick response, windows is working okay and I’ll be trying out a few other linux OSs.

    • Kirk Schnable Kirk Schnable on March 6, 2016 at 2:36 PM said:

      Hello,

      I generally prefer to help people here in this public forum so others can benefit as well, but I definitely understand your desire to have a more interactive conversation. I can post the results here afterward if your issues haven’t already been covered.

      I will send you an email to the address you entered into your comment field.

      Cheers,
      Kirk

  16. Hi can you help me configure the failover IP on Suse Linux

  17. hi can you help me configure my ip fail over for suse linux enterpise 11?

  18. I love you dude!

  19. Abdelaziz on March 21, 2016 at 2:07 PM said:

    i have followed the steps you said but seems like i got no luck on getting the internet to work i use windows server 2012 for both dedi and VM i’ve assigned MAC address of the IP i’ve bought and ive put the IP IN IPv4 than subnet : 255.255.255.255 then the default gateway is : dedi’s main ip except for last number changed to 254 and DNS is : 213.186.33.99 and still no internet…

    • Kirk Schnable Kirk Schnable on April 2, 2016 at 5:12 PM said:

      You’re running Windows Server 2012 on the dedicated?

      So you are using Hyper-V?

      Networking in Hyper-V can be set up in bridged or routed mode. For this guide, the network is expected to be in bridged mode. Is yours set up this way?

  20. Dedetok on June 12, 2016 at 8:13 PM said:

    Hello, please help to configure dom0 network. dom0 host is Debian jessie. I need to configure domu to accept different subnet from ip main (dom0) in OVH.
    Here is my dom0 /etc/network/interface:
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet manual

    auto br0
    iface br0 inet static
    bridge_ports eth0
    address a.b.c.81
    netmask 255.255.255.0
    network a.b.c.0
    broadcast a.b.c.255
    gateway a.b.c.254
    bridge_stp on
    bridge_maxwait 0

    # internal dhcp
    auto virbr0
    iface virbr0 inet static
    address 192.168.0.1
    netmask 255.255.255.0
    broadcast 192.168.0.255
    pre-up brctl addbr virbr0
    Question:
    how do I add these ip subnet into my dom0 configuration. here is ip block from OVH
    Network IP : x.y.z.144
    IP for router n°1 : x.y.z.148
    IP for router n°1 : x.y.z.149
    Gateway IP : x.y.z.150 (not usable)
    Broadcast IP: : x.y.z.151

    Then use the sub-netmask 255.255.255.248.

    For your information, your block has the following characteristics:

    x.y.z.144/29
    Network IP :x.y.z.144
    Broadcast IP :x.y.z.151
    Gateway IP :x.y.z.150
    Netmask :255.255.255.248

    Thank you
    Sincerely
    Dedetok

  21. Tks so much Kirk for all this.

  22. I deploy an appliance on VMWare ESXi 6 On Cloud OVH.

    I did all your steps, but I couldn’t set the default gateway for the VM .. and also I couldn’t access the file system of Linux, only some commands that I can configure and run this appliance through..

    every time entering the default gateway ( Server IP , with last octal 254 ) , I received error message : ” Failed setting route to This IP ”

    how can I set the default gateway ?

    • Kirk Schnable Kirk Schnable on August 18, 2016 at 2:38 AM said:

      You may need to try adding a static route to the default gateway first. In most Linux install environments, it should be possible to drop to a TTY by pressing CTRL+ALT+F1 and enter commands on the shell.

  23. Marcelo on August 17, 2016 at 4:12 PM said:

    Thank you very much! I am several hours trying and you explained everything that no one explained.

  24. Robert Hartnett on October 10, 2016 at 3:10 AM said:

    Ok, so I am running Ubuntu 12.04 LTS on a VM through XenServer, and have followed the guide to set my IP and it seems that my VM can not reach any other IP.

    interface file:

    ———————————————————-

    auto eth0
    iface eth0 inet static
    address FAILOVER
    netmask 255.255.255.255
    broadcast FAILOVER
    dns-nameservers 213.186.33.99
    post-up route add DEDI.254 dev eth0
    post-up route add default gw DEDI.254
    post-down route del DEDI.254 dev eth0
    post-down route del default gw DEDI.254

    ————————————————————————-

    It seems nothing I do gets it working. Last time I had this issue, it just sorted its self out and started working. This time I dont feel like waiting as its already been over 24 hours.

    Any ideas?

    • Kirk Schnable Kirk Schnable on October 31, 2016 at 12:14 PM said:

      Apologies for the delayed response, been pretty busy lately. Your configuration seems fine to me from reading your description. Were you able to get it working?

  25. Hi Kirk

    I am trying to do this for a VM on a Windows Server 2012.

    I know it not the way it should be done but if you know how to get it to work it would be a major help to me.

    See I have had this server for about 2 years now from OVH and it is setup as a Windows Server 2012 for running network applications. However the need of a Linux server for hosting a new web app has just come about.

    I figured I could install VirtualBox right onto the Windows Server 2012 OS and use a failover IP. But so far I can’t link my fallover IP to the VM. Is this even possible ?

    • Kirk Schnable Kirk Schnable on October 31, 2016 at 12:16 PM said:

      Hi Scott,

      I don’t see why this wouldn’t work. Just use VirtualBox’s bridged networking, bridge to your main ethernet adapter, and make sure the virtual MAC address of the VM is registered with OVH’s panel.

      I think as long as you’re using bridged networking mode, OVH’s routers should see the VM’s MAC address just the same as with any other virtualization platform.

      Cheers,
      Kirk

      • I got my IP linked to a mac address through the control panel.

        I setup virtualbox and do a Ubuntu server install with bridged mode for networking and tell it to use the only NIC that the server has.

        But it never sees the network and when I manually set it, it never works.

        So no matter what I do I can’t get my VM that running on my server inside of Windows Server 2012 OS to attach to my IP and gateway to be seen on the web.

        I know how to do it when setting up the server to host VM’s but this is the 1st time I ever had a server running an OS like Windows and then installing a VM program onto its OS and trying to run another OS that can talk to the net. But that’s because the setup I needed at the time was 100% windows server 2012 and all hardware allotted for the past 2 years till now.

        It got me confused, figure I just add the VM, tell it to use the main nic, and set a failover IP to the VM nic. But that doesn’t seem to be the case.

        • Kirk Schnable Kirk Schnable on October 31, 2016 at 10:40 PM said:

          What do you mean by it never “sees” the network? OVH won’t provide a DHCP lease for your VM just because the MAC is set. You always have to set it statically.

          I may be able to help further if you can provide screenshots of the following, you can just upload them somewhere and post links for me.
          – Your virtual box network adapter configuration for the VM.
          – Output of ‘ifconfig’ and\or ‘ip addr show’ on the VM itself.
          – Output of ‘route -n’ on the VM itself.
          – Your /etc/network/interfaces file.

          Cheers,
          Kirk

          • No I mean when I set it to bridge and install Ubuntu, it doesn’t see a nic at all or create one. When I manually add the information (Failover IP, Gateway, ect..) to the interfaces file, it still doesn’t work or create a nic to use. When the OS loads it will even say “Can’t raise network” when doing the check off’s during loading.

            If I set it up as a clean install using NAT mode, it will connect to the internet, but if I edit the interfaces file to meet the IP info needed and switch back to Bridge mode, it doesn’t work and says it can’t raise the network when booting.

            After playing with it I see it has a down interface with the MAC I assigned the VM. So I brought it up and gave it all the IP info. But still not able to connect to the internet, however this did get rid of the can’t “raise the network” error.

            images can be found within this web directory

            http://www.greyguardclan.com/images/vm

            • Your not goanna believe this Kirk,

              After posting this, I walked away to get some food, came back loaded back up VirtualBox, it reset my VM settings to NAT so I changed it back to bridge which is what it was in when I couldn’t connect.

              Well now it’s connected and I can access the server via that IP.

              Very weird as I had rebooted the vm after changes, the only thing different this time was I closed out Virtualbox 100% to go get some food.

              But now I am connected to the network

  26. Francis on February 14, 2017 at 8:48 PM said:

    Thanks for the tutorial i’m on it since 5 days. It really apreciated

  27. Itachi San on February 19, 2017 at 5:59 AM said:

    Hi Kirk,

    Thanks for your tutorial, but I have an issue.
    I’ve done all the step as you explained, but I can’t reach the internet.

    From the host I can ping the additionnal IP that I’ve setup in the virtualbox VM.
    From the guest I can ping the default gw.
    From an other pc over the internet I can ping the additionnal IP linked to the VM.

    But unfortenately from the guest I can’t access to the internet throw the browser like firefox for instance.

    Someone have an idee ?

    Thanks in advance.

    Itachi San.

Leave a Reply

Your email address will not be published. Required fields are marked *

Are you an intelligent human being? * Time limit is exhausted. Please reload CAPTCHA.

Post Navigation