如何使用网络“指标”在一台 PC 中管理两个 NICS?

ml4*_*603 5 networking

我正在从 Windows 7 迁移到 Ubuntu MATE 15.10

每台台式电脑都连接在 2 个网络上。网络 1 可以访问 Internet,网络 2 没有。两个网络之间的唯一连接是桌面。网络 1 由 DHCP 路由器 192.168.1.1 提供服务。网络 2 由 DHCP 路由器 192.168.2.1 提供服务。

我不想禁用任一路由器的 DHCP,因为白天有许多其他设备与两个网络中的每一个连接和断开连接。

我想使用网络“指标”来确定连接的优先级,以便网络一获得所有互联网流量:

网络 1 的指标为 10,网络 2 的指标为 100

Ubuntu 网络连接 GUI 已安装,但未配置。我摆弄了该/etc/network/interfaces文件以尝试设置指标:

auto lo
iface lo inet loopback

iface eth1 inet dhcp
metric 10

iface eth2 inet dhcp
metric 100
Run Code Online (Sandbox Code Playgroud)

这会根据顶部栏中的连接指示器完全禁用两个网络连接。

如何让两个网络连接正常工作并在网络 1 上路由互联网流量?

Ter*_*nce 5

/etc/network/interfaces应该如下所示以保持接口启用。

auto lo
  iface lo inet loopback

auto eth1
  iface eth1 inet dhcp 
  metric 10

auto eth2
  iface eth2 inet dhcp 
  metric 100
Run Code Online (Sandbox Code Playgroud)

man interfaces页面:

   Lines beginning with the word "auto" are used to identify the physical
   interfaces to be brought up when ifup  is  run  with  the  -a  option.
   (This  option is used by the system boot scripts.)  Physical interface
   names should follow the word "auto" on the same line.   There  can  be
   multiple  "auto"  stanzas.  ifup brings the named interfaces up in the
   order listed.
Run Code Online (Sandbox Code Playgroud)

因此,输入这个词auto将使这些连接在启动时或重新启动网络时出现。

希望这可以帮助!