Unstable connectivity on Ubuntu server 14.04 with two network adapters

Rouli asked:

I’m experiencing a weird behaviour on my server.
It is a virtual machine, running on ESXi which is hosted on a “so you start server” from OVH.
i want the virtual machine to have two network adapters: one that links to the internal LAN, and another that goes to the internet (outside) using OVH IP failover system.

Howerver, when both interfaces are running simultaneously, the server’s connexion to the internet is unstable on WAN and LAN. Sometimes it can ping the outside (google.com) and the next minute it can’t.

Here’s the content of /etc/network/interfaces

# 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

# The primary network interface
auto eth0
iface eth0 inet static
        # dns-* options are implemented by the resolvconf package, if installed
        dns-search qwerteach.com
auto eth1
iface eth1 inet static
        address my.wan.ip.xxx
        broadcast my.wan.ip.xxx
        post-up route add ovh.gw.xxx.xxx dev eth1
        post-up route add default gw ovh.gw.xxx.xxx dev eth1
        pre-down route del ovh.gw.xxx.xxx dev eth1
        pre-down route del default gw ovh.gw.xxx.xxx dev eth1

        up route add -net netmask gw

where ovh.gw.xxx.xxx is the custom gateway ovh requires to use the ip failover (as described here)

Any insight?
Thanks in advance!

My answer:

Your netmask is wrong. Though, it’s not your fault; the OVH guide is wrong too. The netmask should be set to and the post-up route add and pre-down route del lines should not exist.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.