Linux学习笔记--链路聚合(team)

链路聚合技术的应用:企业的 Linux 服务器环境上,网络配置都会使用 Bonding 技术做网口硬件层面的冗余,防止单个网口应用的单点故障。
Linux内核自带bonding(配置)驱动程序,在Red Hat Enterprise Linux 7中添加了team驱动程序,team驱动程序并不是试图复制或模仿键合驱动程序,而是使用完全不同的设计和方法来解决相同的问题;一种特别注意灵活性和效率的方法。最好的部分是团队驱动程序的配置、管理和监视得到了显著的改进,而不会影响性能、特性或吞吐量。(摘自红帽文档

team 模式

1 broadcast - Basic mode in which all packets are sent via all available ports.
2 roundrobin - Basic mode with very simple transmit port-selecting algorithm based on looping around the port list. This is the only mode able to run on its own without userspace interactions.
3 random - Basic mode similar to the previous one. Transmit port is selected randomly for each outgoing skb.
4 activebackup- In this mode, only one port is active at a time and able to perform transmit and receive of skb. The rest of the ports are backup ports. Mode exposes activeport option through which userspace application can specify the active port.
5 loadbalance - A more complex mode used for example for LACP and userspace controlled transmit and receive load balancing. LACP protocol is part of the 802.3ad standard and is very common for smart switches. Hashing is used to identify similar skbs. Hash length is 8 bits so there are 256 variants of skbs (multiple different skbs can fall into one hash). The hash computation mechanism is BPF (Berkeley Packet Filter) based. This mode exposes the following options.
如果以上模式没有你需要的,还可以自己定义。
摘自红帽文档
查看本机支持team的模式 实例文件如下

ll -la  /usr/share/doc/teamd-1.17/example_configs/

在这里插入图片描述

下面以 activebackup 主备模式进行 team 建立的示例(Vmware虚拟机中使用)

1.先添加两块网卡(关机状态)

ctrl +d 打开虚拟机设置
选择添加
在这里插入图片描述
点击网络适配器,在点击完成
在这里插入图片描述
网卡添加成功
添加完两块网卡后,确保网卡模式一致。
在这里插入图片描述
查看网卡

nmcli device     //查看设备是否存在

在这里插入图片描述

2激活设备连接会话
nmcli device connect eno33554992
nmcli device connect eno50332216
3创建链路聚
nmcli connection add type team con-name team0 ifname team0 config '{"runner":       {"name": "activebackup"}}'   //创建team0会话选择链路聚合模式
nmcli connection show 			//查看创建好的team0会话
nmcli connection modfiy team0 ipv4.address + ip	//修改会话的ip地址
nmcli connection modfiy team0 ipv4.gateway + ip	//修改会话的网关
nmcli connection modfiy team0 ipv4.method manual //更改ip地址获取方式为手动
nmcli connectino show team0
nmcli connection add type team-slave con-name team0-port1 ifname eno33554992 master team0 //添加设备到team0
nmcli connection add type team-slave con-name team0-port2 ifname eno50332216 master team0
nmcli connection up team0-port1 //激活从设备
nmcli connection up team0-port2
nmcli connection up team0 	//激活主设备
#删除team0
先删除从网卡
nmcli connection delete team0-port1
nmcli conneciton delete team0-port2
在删除team0
nmcli connection delete team0
teamdctl team0 state 		//查看启动后的team0状态

在这里插入图片描述

team桥接配置

1 配置team
2 桥配置
nmcli device disconnect team0   //断掉team设备
nmcli stop NetwworkManager.service   //停用NetworkManger服务
vim /etc/sysconfig/network-scripts/ifcfg-br0  //配置桥文件

写入以下信息(ip 掩码自定)手动配置以防dhcp获取ip时team0与桥ip冲突
在这里插入图片描述

vim /etc/sysconfig/network-scripts/ifcfg-team0   //编辑team0配置文件
添加桥设备名称

在这里插入图片描述

systemctl restart NetworkManager //重启网络服务
nmcli device connect team0   //启动设备
  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值