RH8在当前主机添加两块网卡,将两块网卡绑定实现网卡冗余操作
添加两块网卡
网卡设备和会话进行连接
team网卡
- 主备模式(网卡冗余)
- 广播模式
- 随机模式
- 负载均衡模式
- 轮循模式
主备模式配置
网卡示例配置文件
cd /usr/share/doc/teamd/example_configs/
添加虚拟网卡
nmcli connection add type team con-name team0 ifname team0 config '{"runner": {"name": "activebackup"}}'
虚拟网卡要绑定真实网卡 需添加从接口,从设备
[root@localhost zx]# nmcli connection add type team-slave con-name team0-port1 ifname ens224 master team0
Connection 'team0-port1' (0958c207-cd68-4127-a10c-4c2021c46025) successfully added.
[root@localhost zx]# nmcli connection add type team-slave con-name team0-port2 ifname ens256 master team0
Connection 'team0-port2' (c68d970b-f05d-467d-afbb-39f218c2e02e) successfully added.
[root@localhost zx]# nmcli connection show
NAME UUID TYPE DEVICE
team0 c455eea1-c47e-438d-9cb1-5b507db00cbb team team0
ens160 dd4b0fae-5dc8-44d0-8486-7109cdb5c190 ethernet ens160
Wired connection 1 6e311b9e-82f9-36af-b28f-60e2ce1bd4a2 ethernet ens256
Wired connection 2 bc5cb843-f26b-3ed2-b8d2-20af3cd99ee0 ethernet ens224
team0-port1 0958c207-cd68-4127-a10c-4c2021c46025 ethernet --
team0-port2 c68d970b-f05d-467d-afbb-39f218c2e02e ethernet --
激活从会话
[root@localhost zx]# nmcli connection up team0-port1
[root@localhost zx]# nmcli connection up team0-port2
激活主会话重新识别从会话
[root@localhost zx]# nmcli connection up team0
[root@localhost zx]# teamdctl team0 stat
setup:
runner: activebackup
ports:
ens224
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
ens256
link watches:
link summary: up
instance[link_watch_0]:
name: ethtool
link: up
down count: 0
runner:
active port: ens224
[root@localhost zx]# nmcli connection down team0-port1