机器上的两个 NIC,将它们绑定到 OS 分配的单独接口

Two NICs on the machine, bind them to the separate interfaces assigned by OS

我目前正在用我的 Raspberry Pi 3 做一个项目,但现在遇到了一些问题。

我在 RPi 上有两个 NIC(一个在 SOC 上的内部 NIC 和一个外部 NIC),并将两个接口(wlan0 和 wlan1)配置为具有不同的功能。但是由于外部 NIC 不能完成内部 NIC 可以完成的工作,我希望每次启动时都绑定 OS 分配的 NIC 和接口(例如,带有 wlan0 的内部 NIC 和带有 wlan1 的外部 NIC)提高我的 RPi。

有什么方法可以达到我的要求吗?非常感谢任何提示或建议!

我树莓派上的OS运行是Raspbian,Linux内核版本是4.1.19.

我猜您正在寻找在两个 NIC 之间建立联系的方法,对吗? 不了解 Raspian,但在纯 Debian 中非常简单(为 wi-fi USB 加密狗和 virtualbox 中的桥接接口做了这个没有太大问题):

/etc/network/interfaces

auto eth0
iface eth0 inet static
address 192.168.1.10
gateway 192.168.1.254
netmask 255.255.255.0

auto eth1
iface eth1 inet manual
bond-master bond0
bond-primary eth0

auto eth2
iface eth2 inet manual
bond-master bond0

auto bond0 
iface bond0 inet dhcp
bond-miimon 100
bond-slaves none

您仍然需要注意设置 WPA 配置(在同一个文件中工作),这里有一些 URL 可以帮助您:

我不确定你想要什么,但我认为你想确保为 Raspberry Pi 上的每个 NIC 分配正确的名称。如果是这样,您需要设置一个 udev 规则,根据 NIC 的唯一 MAC 地址设置接口名称。您将使用 sudo 编辑 /etc/udev/rules.d/70-persistent-net.rules 并使其像这样:

# interface with MAC address "aa:bb:cc:dd:ee:ff" will be assigned "eth0"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="aa:bb:cc:dd:ee:ff", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

# interface with MAC address "mm:nn:oo:pp:qq:rr" will be assigned "eth1"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="mm:nn:oo:pp:qq:rr", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"