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
        address 10.110.110.199
        netmask 255.255.255.0
        network 10.110.110.0
        broadcast 10.110.110.255
        gateway 10.110.110.254
        # dns-* options are implemented by the resolvconf package, if installed
        dns-nameservers 8.8.8.8
        dns-search qwerteach.com
auto eth1
iface eth1 inet static
        address my.wan.ip.xxx
        netmask 255.255.255.255
        broadcast my.wan.ip.xxx
        dns-nameservers 8.8.8.8
        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 10.110.112.0 netmask 255.255.255.0 gw 10.110.110.254

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 255.255.255.0 and the post-up route add and pre-down route del lines should not exist.


View the full question and answer on Server Fault.

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