在当前主机(虚拟机)添加两块网卡,将两块网卡绑定实现网卡冗余操作
1.先在虚拟机上添加网卡–添加网络适配器
且模式相同
2.然后打开虚拟机终端,输入ip a查看网卡是否添加成功
这里就激活了两个网卡
3.添加虚拟网卡
代码:
[root@localhost ~]# nmcli connection add type team ifname team0 con-name team0 config ‘{“runner”:{“name”:”activebackup”}}’
Connection ‘team0’ (4afa7466-2898-499f-a079-92bcf34eb204) successfully added.
[root@localhost ~]#
4.虚拟网卡绑定真实网卡
[root@localhost ~]# nmcli connection add type team-slave ifname ens224 con-name team0-port1 master team0
Connection ‘team0-port1’ (4ad46bef-9142-45f6-a092-e90ab3cbf7c4) successfully added.
[root@localhost ~]# nmcli connection add type team-slave ifname ens256 con-name team0-port2 master team0
Connection ‘team0-port2’ (037749c6-8257-43a4-9a2d-3a114e45e5c1) successfully added.
7: team0: mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 5e:d1:87:27:b5:96 brd ff:ff:ff:ff:ff:ff
通过查看,发现team0并没有激活,所以还要激活team0
5.激活team0
激活顺序:先从后主
[root@localhost ~]# nmcli connection up team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/6)
[root@localhost ~]# nmcli connection up team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/7)
[root@localhost ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@localhost ~]#
2)查看会话,是否激活成功—-nmcli connection show
6.测试网卡绑定状态