实验要求:
在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作。
1、添加两块网卡
1)、打开虚拟机设置,点击网络适配器,然后添加。
2)、添加两个网络适配器,如图下所示:
2、激活网卡
1)、查看本地网卡的情况
```
[root@localhost ~]# nmcli device
DEVICE TYPE STATE CONNECTION
ens160 ethernet connected ens160
ens224 ethernet connected Wired connection 2
ens256 ethernet connected Wired connection 1
virbr0 bridge connected (externally) virbr0
lo loopback unmanaged --
```
2)、激活网卡
```
[root@localhost ~]# nmcli device connect ens224
Device 'ens224' successfully activated with '86d51163-1571-3b91-974e-c2c8654e7b64'.
[root@localhost ~]# nmcli device connect ens256
Device 'ens256' successfully activated with '3fecf83b-5e95-3aea-98f0-6657af5c80ae'.
```
3)、通过ip a可以看到本地网卡的地址信息
3、添加 虚拟网卡team0
```
[root@localhost ~]# nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name":"activebackup"}}'
Connection 'team0' (492ad39e-a2a3-4009-bbaa-1be78de79839) successfully added.
```
4、虚拟网卡绑定真实网卡
```
[root@localhost ~]# nmcli connection add type team-slave ifname ens224 con-name team0-port1 master team0
Connection 'team0-port1' (c9a8a1e7-6ed3-4a96-aa59-188220a09b99) successfully added.
[root@localhost ~]# nmcli connection add type team-slave ifname ens256 con-name team0-port2 master team0
Connection 'team0-port2' (34240370-bf76-472f-b1ad-4a879e0728e5) successfully added.
通过ip a可以看出team0并没有被激活
```
5、激活team0
1)、激活顺序:先从再主
```
[root@localhost ~]# nmcli connection up team0-port1
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/8)
[root@localhost ~]# nmcli connection up team0-port2
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/9)
[root@localhost ~]# nmcli connection up team0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/10)
```
2)、查看当前的会话
6、测试网卡绑定状态