重启时默认路由丢失

Ste*_*ere 7 networking 11.10

升级到 11.10 后,每次机器重新启动时,我的系统都会“忘记”到互联网的默认路由。它“记住”到办公室的路线(在第二个 NIC 上)。在我的 /etc/network/interfaces 文件中,我将两个 NIC 配置为静态并为每个指定 IP、网络掩码和网关。但是外部 NIC 的网关不再在启动时设置(尽管它在 11.04 中运行良好)。

我想知道它是否与我和其他人看到的“等待网络配置”问题有关。无论哪种方式,我都需要一个解决方案或至少一个变通方法。

根据要求... route -v(当然,在我手动添加了 eth1 默认网关之后 - 之前看到它,想象缺少 eth1 网关行):

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         216.199.48.57.n 0.0.0.0         UG    0      0        0 eth1
default         192.168.42.1    0.0.0.0         UG    100    0        0 eth0
192.168.42.0    *               255.255.255.0   U     0      0        0 eth0
216.199.48.56   *               255.255.255.248 U     0      0        0 eth1
Run Code Online (Sandbox Code Playgroud)

/etc/network/interfaces

# The loopback network interface
auto lo
iface lo inet loopback

# Office network
auto eth0
iface eth0 inet static
        address 192.168.42.4
        netmask 255.255.255.0
        gateway 192.168.42.1

# Internet
auto eth1
iface eth1 inet static
        address 216.199.48.58
        netmask 255.255.255.248
        gateway 216.199.48.57
Run Code Online (Sandbox Code Playgroud)

Eri*_*lho 3

根据定义,“默认”是一个独特的实体。“gateway”语句设置默认网关,因此它在文件中必须是唯一的。这种情况需要您设置到您的专用网络的静态路由。将 eth0 网关线替换为up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.42.1.

# Office network
auto eth0
iface eth0 inet static
        address 192.168.42.4
        netmask 255.255.255.0
        up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.42.1
Run Code Online (Sandbox Code Playgroud)