我已经为 4 网卡绑定和静态 IP 制作了这个 yaml,但我需要向绑定添加四个 VLAN。VLAN 是 77、88、99、333,有人能帮我完成这个配置吗?我还使用带有 br0 的 KVM 桥的配置,需要它仍然正常工作。
当前的 yaml 可以工作,但只需要添加 VLAN。
https://gist.githubusercontent.com/R...nager-all.yaml
network:
bridges:
br0:
addresses:
- 10.0.77.2/24
dhcp4: false
gateway4: 10.0.77.1
nameservers:
addresses:
- 10.0.77.1
- 8.8.8.8
interfaces:
- bond0
bonds:
bond0:
interfaces:
- eno1
- eno2
- eno3
- eno4
parameters:
mode: balance-xor
ethernets:
eno1:
addresses: []
dhcp4: false
dhcp6: false
eno2:
addresses: []
dhcp4: false
dhcp6: false
eno3:
addresses: []
dhcp4: false
dhcp6: false
eno4:
addresses: []
dhcp4: false
dhcp6: false
答案1
这是我开始使用的 netplan 文件。我假设 vlan77(来自 10.0.77.0/24)是本机,绑定是中继。我还假设您希望虚拟机位于不同的 vlan 中:
#/etc/netplan/01-networkd-vlan-bond.yml
network:
version: 2
renderer: networkd
ethernets:
eno1:
addresses: []
dhcp4: false
dhcp6: false
eno2:
addresses: []
dhcp4: false
dhcp6: false
eno3:
addresses: []
dhcp4: false
dhcp6: false
eno4:
addresses: []
dhcp4: false
dhcp6: false
bonds:
bond0:
interfaces: [eno1, eno2, eno3, eno4]
addresses: [10.0.77.2/24]
gateway4: 10.0.77.1
nameservers:
addresses: [10.0.77.1,8.8.8.8]
search: [domain.tld]
dhcp4: false
dhcp6: false
parameters:
mode: balance-xor
bridges:
br0:
interfaces: [ bond0 ]
dhcp4: false
dhcp6: false
parameters:
forward-delay: 0
stp: true
br88:
interfaces: [ vlan.88 ]
dhcp4: false
dhcp6: false
addresses: []
parameters:
forward-delay: 0
stp: true
br99:
interfaces: [ vlan.99 ]
dhcp4: false
dhcp6: false
addresses: []
parameters:
forward-delay: 0
stp: false
br333:
interfaces: [ vlan.333 ]
dhcp4: false
dhcp6: false
addresses: []
parameters:
forward-delay: 0
stp: true
vlans:
vlan.88:
id: 88
link: bond0
dhcp4: false
dhcp6: false
vlan.99:
id: 99
link: bond0
dhcp4: false
dhcp6: false
vlan.333:
id: 333
link: bond0
dhcp4: false
dhcp6: false
这一切都假设 vlan77 是本机 vlan,如果不是这种情况,则需要进行一些修改。由于 vlan77 是本机的,因此您不需要为 vlan77 单独设置条目。
我通过 dhcp 服务器分配所有 IP 地址,因此我的设置略有不同,我注意到在某些网络上,我必须将绑定和本机 vlan 都设置为接收 dhcp 寻址,因此您可能需要在绑定和本机桥中输入相同的 IP 地址信息,在您的情况下,它看起来像这样:
br0:
interfaces: [ bond0 ]
dhcp4: false
dhcp6: false
addresses: [10.0.77.2/24]
gateway4: 10.0.77.1
nameservers:
addresses: [10.0.77.1,8.8.8.8]
search: [domain.tld]
parameters:
forward-delay: 0
stp: true
但是您不需要它,因为它没有记录并且确实没有多大意义。