虚拟网卡链路聚合(team-slave)

虚拟网卡(链路聚合):参考 man teamd.conf文件
team 聚合链接,有多块网卡(team-slave)一起组建而成的虚拟网卡,即“主机”
作用1:轮询式(roundrobin)的流量负载均衡
作用2:热备份(activebackup)连接冗余

1.创建虚拟网卡
[root@server-120 ~]# nmcli connection add type team ifname team0 con-name team0 autoconnect yes config '{"runner": {"name": "activebackup"}}'    ==>>创建虚拟网卡team0,参考man teamd.conf文件全文搜索/example,按n往下查找

----------------------------------------------------------------------------------------------------------------------------
nmcli connection add type team ifname team0 con-name team0 autoconnect yes config '{"runner": {"name": "activebackup"}}'
nmcli 连接网络配置 添加 类型 team 网卡名 team0 配置文件名 team0 开机自启 yes 运行方式 热备份方式
----------------------------------------------------------------------------------------------------------------------------

2.添加虚拟网卡成员
[root@server-120 ~]# ifconfig    ==>>查看team0网卡
[root@server-120 ~]# nmcli connection add type team-slave ifname ens33 con-name team0-1 autoconnect yes master team0   ==>>添加从配置网卡1
连接“team0-1”(77613a22-3754-419d-896c-7a356c45a1e3) 已成功添加。
[root@server-120 ~]# nmcli connection add type team-slave ifname ens37 con-name team0-2 autoconnect yes master team0   ==>>添加从配置网卡1
连接“team0-2”(72890882-1710-4959-a852-e00d1e1e5d1c) 已成功添加。

---------------------------------------------------------------------------------------------------------------------
nmcli connection add type team-slave ifname ens33 con-name team0-1 autoconnect yes master team0
nmcli 连接网络配置 添加 类型 team-成员 网卡名 ens33 配置文件名 team0-1 开机自启 yes 主设备 team0
---------------------------------------------------------------------------------------------------------------------

3.配置IP地址
[root@server-120 ~]# nmcli connection modify 'team0' ipv4.method manual ipv4.addresses  '10.0.0.2/24' connection.autoconnect yes        ==>>为虚拟网卡添加静态IP
[root@server-120 ~]# nmcli connection up team0    ==>>启动虚拟网卡配置文件
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/170)
[root@server-120 ~]# nmcli connection up team0-1   ==>>启动网卡33配置文件
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/172)
[root@server-120 ~]# nmcli connection up team0-2   ==>>启动网卡37配置文件
连接已成功激活(D-Bus 活动路径:/org/freedesktop/NetworkManager/ActiveConnection/173)
    (删除操作)[root@server-120 ~]# nmcli connection udelete team0-2   ==>>删除网卡37配置文件
    (查看操作)[root@server-120 ~]# teamdctl team0 state     ==>>查看虚拟网卡状态

你可能感兴趣的:(网络知识,linux)