我试图在Linux键合主动备份(2个物理接口eth2和eth3,其中一个被使用)上进行配置,但也配置两个VLAN,然后将其连接到内部桥接器。我看到了两种连接方式,两种都起作用,
bond-mode 4 = 802.3ad AKA (服务器连接到不同的思科交换机,我已经听说过和看到了这些配置的一些问题),所以bond-mode active-backup需要足够。# 1. Two NICs agregated to one bonding, and then separate VLANS from bonding interface:
eth2 bond1.10 - xenbr10
> bond1 <
eth3 bond1.15 - xenbr15
# 2. VLANs separated form physical NIC, then aggregate to separate binding interfaces.
eth2.15 ...
eth2 <
eth2.10
> bond10 - xenbr10
eth3.10
eth3 <
eth3.15 ...我有带有Debian11的服务器,2个网络接口,安装了软件包vlan、bridge-utils和ifenslave (在2.13版本中测试回购,原因是2.12中的这个问题 )。在系统中加载了8021q和bonding模块。
问题1:连接的第一个选择是最佳实践吗?为什么?我是在问,因为在互联网上找到的大部分(或者全部)教程都是关于第一次连接的(甚至是Debian Wiki)。
这很好,我可以通过控制台或配置文件来完成。缺点是:两个VLAN总是使用单个接口发送的。我当前的/etc/network/interfaces (删除了不重要的元素)
iface eth2 inet manual
iface eth3 inet manual
auto bond1
iface bond1 inet manual
bond-slaves eth2 eth3
bond-mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
iface bond1.10 inet manual
vlan-raw-device bond1
iface bond1.15 inet manual
vlan-raw-device bond1
auto xenbr10
iface xenbr10 inet static
address 1.2.3.4/24
bridge_ports bond1.10在重新启动系统之后,这个配置是正确的,但是我想配置并使用第二个选项。
执行
我可以通过命令行完成这个配置:
ifconfig eth2 up
ifconfig eth3 up
#setting up VLANs
ip link add link eth2 name eth2.10 type vlan id 10
ip link add link eth3 name eth3.10 type vlan id 10
#creating bonding interface with 2 slaves NIC
ip link add name bond1 type bond mode active-backup
ip link set dev eth2.10 down
ip link set dev eth3.10 down
ip link set master bond10 dev eth2.10
ip link set master bond10 dev eth3.10
ip link set up dev bond10
ip link set dev eth2.10 up
ip link set dev eth3.10 up
### Bridge + bonding
brctl addbr xenbr10
brctl addif xenbr10 bond10
ip addr add 1.2.3.4/24 dev xenbr10
ip link set dev xenbr10 up网络已经开通:
cat /proc/net/bonding/bond10
Ethernet Channel Bonding Driver: v5.10.0-12-amd64
Bonding Mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: eth2.10
MII Status: up
(..)
Slave Interface: eth2.10
MII Status: up
Speed: 1000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: (..)
Slave Interface: eth3.10
MII Status: up
(..)但是我不能创建配置文件来使这个永久化。我尝试过很多这样的选择,但没有运气。如果我将接口eth2.10直接连接到某些xenbr10,它就能工作。
iface eth2.10 inet manual
vlan-raw-device eth2
iface eth3.10 inet manual
vlan-raw-device eth3
bond-master bond10 #It doesn't change nothing, for testing
auto bond10
iface bond10 inet manual
bond-slaves eth2.10 eth3.10
#bond-slaves none
bond-mode active-backup
bond-miimon 100
bond-downdelay 200
bond-updelay 200
auto xenbr10
iface xenbr10 inet static
address 1.2.3.4/24
bridge_ports bond1.10在重新启动系统之后,通常会出现如下错误:
ifup六八六:未能将eth2.10奴役到bond10。bond10准备好了吗?连接接口了吗?
问题2:这个配置有什么问题?我试过了
bond-master bond10配置部分中对eth2.10和bond-slaves none使用bond10条目bond-slaves eth2.10 eth3.10部件中使用bond10条目auto eth2.10发布于 2022-03-25 12:29:55
经过一天的搜索和测试,我找到了两个解决方案。第一个配置可能不太优雅,但有效:
# Using default ifupdown on Debian 11:
# Set up NIC and NIC's alias with VLAN:
auto eth2
iface eth2 inet manual
post-up ip link add link eth2 name eth2.10 type vlan id 10
post-up ip link add link eth2 name eth2.15 type vlan id 15
auto eth3
iface eth3 inet manual
post-up ip link add link eth3 name eth3.10 type vlan id 10
post-up ip link add link eth3 name eth3.15 type vlan id 15
auto bond533
iface bond533 inet manual
bond-slaves eth2.533 eth3.533
bond-mode active-backup
# (...)多亏了A.B.S的评论(链接),我发现了使用ifupdown2的更好的解决方案。贝华意识到:在安装这个包(它移除旧的ifupdown)期间,我已经失去了网络,直到重新启动(也许重新启动网络就足够了,而不是测试)。
# After installing ifupdown2:
# No need to set up physical NIC or VLAN interface!
#iface eth2.10 inet manual
# vlan-raw-device eth2
#iface eth2.533 inet manual
# vlan-raw-device eth2
#Set up bonding and brige (the same as with ifupdown)
auto bond533
iface bond533 inet manual
bond-slaves eth2.533 eth3.533
bond-mode active-backup
# (...)对我来说,这种简单的配置是正确的,这有点奇怪。看起来,ifupdown2可以建立必要的连接-从网络接口(甚至vlans),而不需要更早地配置它们。
https://unix.stackexchange.com/questions/696582
复制相似问题