Ubuntu 服务器 14.04 上两个网络适配器的连接不稳定

Ubuntu 服务器 14.04 上两个网络适配器的连接不稳定

我的服务器出现了奇怪的行为。它是一台虚拟机,运行在 ESXi 上,托管在 OVH 的“so you start server”上。我希望虚拟机有两个网络适配器:一个连接到内部 LAN,另一个使用 OVH IP 故障转移系统连接到互联网(外部)。

但是,当两个接口同时运行时,服务器与互联网的连接在 WAN 和 LAN 上都不稳定。有时它可以 ping 通外部(google.com),但下一分钟就不能了。

这是 /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

其中 ovh.gw.xxx.xxx 是 ovh 需要使用 ip 故障转移的自定义网关(如上所述这里

有什么见解吗?提前致谢!

答案1

netmask错了。不过,这不是你的错;OVH 指南也错了。应该netmask设置为255.255.255.0,并且post-up route addpre-down route del行不应该存在。

相关内容