我已经使用 networkManager 在 Fedora 服务器上创建了一个团队连接
nmcli con add type team con-name team0 ifname team0 config /usr/share/doc/teamd/example_configs/random.conf
nmcli con add type team-slave ifname enp1s0 master team0
nmcli con add type team-slave ifname enp7s0 master team0
nmcli connection modify team0 ethernet.mac-address 01:02:03:04:05:06
nmcli connection up team0
nmcli connection delete ethernet-enp1s0
nmcli connection delete ethernet-enp7s0
命令很简单,我创建了 team0 连接,添加了两个网卡(enp1s0 和 enp7s0),然后我强制 team0 使用 mac 地址 01:02:03:04:05:06(是伪造的..仅出于安全原因)从 dhcp 获取相同的主机名和 IP。工作正常,但重启后...
nmcli conn show
Cable connection 1 3bce3e28-47a0-365b-8290-eda5ff3f7c7b ethernet nm-team
team0 6f97a64b-f341-4cbe-b001-d8bb3faa8768 team --
team-slave-enp1s0 cc6f2e64-8f38-4a83-b1c3-226e22943751 ethernet --
team-slave-enp7s0 ecdefac9-779b-4c86-838b-46e69132c94b ethernet --
尝试激活 team0 时出现此错误
nmcli 连接 team0
nm-team failed to create resources: Failed to create team master interface 'nm-team' for 'team0': wrong-type
答案1
找到解决方案,这一行
nmcli connection modify team0 ethernet.mac-address 01:02:03:04:05:06
让系统有点混乱,并将enp1s0(物理)重命名为team0(虚拟)。删除此行并重做其他行即使在重新启动时也能正常工作,为了从 dhcp 获取相同的 IP,我使用此配置方式
host myhost {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.12;
ddns-hostname "myhost";
ddns-ttl 31536000;
}
host myhost-2 {
hardware ethernet 00:00:00:00:00:00;
fixed-address 192.168.0.12;
ddns-hostname "myhost";
ddns-ttl 31536000;
}