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

链路聚合:两个物理网卡绑定为一个逻辑网卡

红帽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

猜你喜欢

转载自blog.csdn.net/hankunfa/article/details/80474867