Linux链路聚合和桥接(红帽7)

本文介绍在红帽7系统中如何进行链路聚合与桥接的配置,包括使用nmcliconnection命令添加配置文件、配置IP地址、绑定网卡设备等步骤,并展示了如何检查链路聚合的状态。
链路聚合:两个物理网卡绑定为一个逻辑网卡
红帽7中链路聚合的工作的模式
(1)active-backup:主备(用的较多)
(2)loadbalance:负载均衡

(3)RR RoundRobin:轮询

1.链路聚合
添加两块网卡(不用添加配置文件)
nmcli connection show         #显示配置文件和网卡设备
nmcli connection add type team con-name hanteamfile ifname hanteamdevice config '{"runner":{"name":"activebackup"}}'     #添加一个大网卡
nmcli connetion modify hanteamfile ipv4.method manual ipv4.address "192.168.100.88/24 192.168.100.1" ipv4.dns 192.168.100.1 connection.autoconnect yes         #为大网卡配置IP
nmcli connection add type team-slave con-name hanteamslave1 ifname eno33554984 master hanteamdevice                                   #网卡的绑定,主网卡为hanteamdevice
nmcli connection add type team-slave con-name hanteamslave2 ifname eno50332208 master hanteamdevice
nmcli connection down hanteamfile   #down一下配置文件
nmcli connection up   hanteamfile   #up一下配置文件
nmcli connection up   hanteamslave1
nmcli connection up   hanteamslave2

nmcli connection show

2.查看状态
ifconfig | grep ether   #查看各设备的mac地址
teamdctl hanteamdevice state  #查看hanteamdevice的状态
teamnl hanteamdevice ports #查看端口
teamnl hanteamdevice getoption activeport   #查看活跃的端口
nmcli device disconnect eno33554984         #模拟网卡挡了
teamnl hanteamdevice geetoption acticeport  #查看活跃的端口

teamdctl hanteamdevice state                #查看设配的状态

3.桥接 
nmcli connection add type bridge con-name hanbrfile ifname hanbrdevice    #创建一个桥接的配置文件和设备
nmcli connection modify hanbrfile ipv4.method manual ipv4.addresses "192.168.100.88/24 192.168.100.1" ipv4.dns 192.168.100.1 connection.autoconnect yes             #为配置文件设置IP
nmcli connection show
nmcli connection add type bridge-slave con-name hanbrslave ifname eno16777736 master hanbrdevice                                                                #eno16777736桥接在hanbrdevice上面
nmcli connection down hanbrfile                               #down一下hanbrfile
nmcli connection up   hanbrfile                               #up一下hanbrfile
nmcli connection up   hanbrslave        
nmcli connection show 
ping -I hanbrdevice  192.168.100.2   #ping 192.168.100.2来源于hanbrdevice
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值