为什么其中一个虚拟 NIC 称为 bond0?

Jac*_*ack 1 ethernet

刚接手一个很老的网络集群(没有文档和手册),只能自己想象配置的意义。一些服务器的 IP 配置如下(当我发出 ifconfig 时)

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>
        inet 10.1.237.11  netmask 255.255.255.192  broadcast 10.1.237.63
        ether 6c:90:af:68:5a:28  txqueuelen 0  (Ethernet)

bond0.901: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
        inet 147.146.67.13  netmask 255.255.255.240  broadcast 147.146.67.15
        ether 6c:90:af:68:5a:28  txqueuelen 0  (Ethernet)

bond0.901:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>
        inet 147.185.211.5  netmask 255.255.255.0  broadcast 147.185.211.255
        ether 6c:90:af:68:5a:28  txqueuelen 0  (Ethernet)

eth2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>
        ether 6c:90:af:68:5a:28  txqueuelen 1000  (Ethernet)

eth3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>
        ether 6c:90:af:68:5a:28  txqueuelen 1000  (Ethernet)

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        loop  txqueuelen 0  (Local Loopback)
Run Code Online (Sandbox Code Playgroud)

从同一个mac地址,我可以看到只有一个网卡。有人告诉我,bond0 用于内部 IP,bond0.901 用于互联网 IP,bond0.901:1 用于任播 IP。所以我的问题是 eth2 和 eth3 的作用是什么,为什么其中一个虚拟网卡称为 bond0,有什么需要绑定在一起的吗?

当我发出命令:lspci|grep Ether 时,我得到以下信息:

01:00.0 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
01:00.1 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
01:00.2 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
01:00.3 Ethernet controller: Intel Corporation I350 Gigabit Network Connection (rev 01)
04:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
04:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
07:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
07:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
09:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
09:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
Run Code Online (Sandbox Code Playgroud)

以上是否意味着我有 10 个物理网卡?

Zor*_*che 5

我怀疑eth2,eth3是构成设备的物理设备bond0。查看主/从标志。但是您的系统可能有 2 个物理接口,这些接口通过某种容错或链路聚合设置组合在一起。尝试查看这些查询物理硬件的工具的输出lspci | grep Ether,或者lshw -class network。您可能会看到至少 2 个界面。

bond0: flags=5187<UP,BROADCAST,RUNNING,MASTER,MULTICAST>
eth2: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>
eth3: flags=6211<UP,BROADCAST,RUNNING,SLAVE,MULTICAST>
Run Code Online (Sandbox Code Playgroud)

文件的内容/proc/net/bonding/bond0会告诉你更多。

bond0.901是一个虚拟设备,允许在 bond0 上使用标记的 vlan 901。

bond0.901:1只是bond0.901VLAN 901 接口的辅助 IP 地址。这不是真正的界面,甚至不是虚拟界面。这个“接口”只是 ifconfig 向您显示第二个地址的一种方式。但它是一个不推荐使用的工具,它会给你这样令人困惑的输出。使用ip addr, 或ip link代替。