当前位置:   article > 正文

华为交换机配置端口聚合(对应ubuntu18服务器bonding)_主备交换机之间可以端口聚合吗

主备交换机之间可以端口聚合吗

一、服务器环境和交换机环境

1、服务器

ubuntu18  4.15.0-159-generic  

2、交换机

Huawei Versatile Routing Platform Software
VRP (R) software, Version 5.170 (S5720 V200R010C00SPC600)
Copyright (C) 2000-2016 HUAWEI TECH CO., LTD
HUAWEI S5720S-28P-SI-AC Routing Switch uptime is 0 week, 1 day, 5 hours, 8 minutes

3、网卡绑定的作用

  • 当一个网卡不够用的时候,可以使用两个网卡绑定在一起增加带宽
  • 当一个网卡断的话,另一个网卡可以形成备份,增加链路冗余
  • 主备模式只能做成链路备份,不能负载,负载需要服务器和交换机互相配合

4、bond 的七种模式

每种模式的特点可以参考(Linux----bond技术及mode模式详解_weixin_45726050的博客-CSDN博客

这七种模式分别是:
802.3ad balance-alb balance-tlb broadcast active-backup balance-rr balance-xor

mode=0 round-robin轮询策略(Round-robin policy)
mode=1 active-backup主备策略(Active-backup policy)
mode=2 load balancing (xor)异或策略(XOR policy)
mode=3 fault-tolerance (broadcast)广播策略(Broadcast policy)
mode=4 lacp IEEE 802.3ad 动态链路聚合(IEEE 802.3ad Dynamic link aggregation) #我这边使用是这种模式
mode=5 transmit load balancing适配器传输负载均衡(Adaptive transmit load balancing)
mode=6 adaptive load balancing适配器负载均衡(Adaptive load balancing)

二、服务器配置

1、查看有没有bonding kernel module,一般ubuntu18,默认就有的。

modinfo bonding | head -n 3

#安装ifenslave

apt-get install ifenslave

filename: /lib/modules/4.15.0-159-generic/kernel/drivers/net/bonding/bonding.ko
author: Thomas Davis, tadavis@lbl.gov and many others
description: Ethernet Channel Bonding Driver, v3.7.1

##加入bonding模块

echo "bonding" >>/etc/modules

2、网络配置

vim /etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo

iface lo inet loopback

auto eno1

iface eno1 inet manual

bond-master bond0

bond-primary eno1

bond-mode 4

auto eno2

iface eno2 inet manual

bond-master bond0

bond-primary eno2

bond-mode 4

auto bond0

iface bond0 inet static

address 192.168.10.113

netmask 255.255.255.0

gateway 192.168.10.254

slaves eno1 eno2

bond-mode 4

bond-miimon 100

bond-downdelay 200

bond-updelay 200

3、重启网卡

#/etc/init.d/networking restart

如果重启网卡报错,就重启机器

4、查看bonding状态

#cat /proc/net/bonding/bond0

Ethernet Channel Bonding Driver: v3.7.1 (April 272011)

Bonding Mode: IEEE 802.3ad Dynamic link aggregation

Transmit Hash Policy: layer2 (0)

MII Status: up

MII Polling Interval (ms): 100

Up Delay (ms): 200

Down Delay (ms): 200

802.3ad info

LACP rate: slow

Min links: 0

Aggregator selection policy (ad_select): stable

System priority: 65535

System MAC address: ac:1f:6b:e1:d6:05

Active Aggregator Info:

        Aggregator ID: 1

        Number of ports: 2

        Actor Key: 9

        Partner Key: 561

        Partner Mac Address: e8:68:19:c9:7d:60

Slave Interface: eno2

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: ac:1f:6b:e1:d6:05

Slave queue ID: 0

Aggregator ID: 1

Actor Churn State: none

Partner Churn State: none

Actor Churned Count: 0

Partner Churned Count: 0

details actor lacp pdu:

    system priority: 65535

    system mac address: ac:1f:6b:e1:d6:05

    port key: 9

    port priority: 255

    port number: 1

    port state: 61

details partner lacp pdu:

    system priority: 32768

    system mac address: e8:68:19:c9:7d:60

    oper key: 561

    port priority: 32768

    port number: 2

    port state: 61

Slave Interface: eno1

MII Status: up

Speed: 1000 Mbps

Duplex: full

Link Failure Count: 0

Permanent HW addr: ac:1f:6b:e1:d6:04

Slave queue ID: 0

Aggregator ID: 1

Actor Churn State: none

Partner Churn State: none

Actor Churned Count: 0

Partner Churned Count: 0

details actor lacp pdu:

    system priority: 65535

    system mac address: ac:1f:6b:e1:d6:05

    port key: 9

    port priority: 255

    port number: 2

    port state: 61

details partner lacp pdu:

    system priority: 32768

    system mac address: e8:68:19:c9:7d:60

    oper key: 561

    port priority: 32768

    port number: 1

    port state: 61

三、交换机配置


1、首先进入system-view 进入以太网端口视图

>system-view

#进入聚合口trunk2
interface Eth-Trunk2

#配置为接入模式
port link-type access 

# 放行vlan,如果用的是默认的vlan1,那可以不需要执行
port default vlan ID

#模式
mode lacp 

#流量分流算法模式,总共有6总,常用的是src-dst-ip
load-balance src-dst-ip

#配置之后可以 dis this 查看一下配置

display this
#
interface Eth-Trunk2
port link-type access
port default vlan 192
mode lacp
#


** 注意:
加入聚合之前请删除端口中的配置**

undo eth-trunk
undo link-type

2、配置聚合端口信息

# 进入g 1/0/19 端口

interface GigabitEthernet1/0/19

#** 加入trunk2**
eth-trunk 2


#跟上面一样进入另一个端口加入聚合

#进入g 2/0/2 端口
interface GigabitEthernet2/0/20

#加入trunk2
eth-trunk 2

查询: dis interface Eth-Trunk 查看所有聚合表

display interface Eth-Trunk

Eth-Trunk2 current state : UP

Line protocol current state : UP

Description:

Switch Port, Link-type : access(configured),

PVID :    1, Hash arithmetic : According to SIP-XOR-DIP,Maximal BW: 2G, Current BW: 2G, The Maximum Frame Length is 9216

IP Sending Frames' Format is PKTFMT_ETHNT_2, Hardware address is e868-19c9-7d60

Current system time: 2021-10-12 12:52:24

Last 300 seconds input rate 6984 bits/sec, 6 packets/sec

Last 300 seconds output rate 19608 bits/sec, 12 packets/sec

Input:  24351 packets, 2528598 bytes

  Unicast:                      23372,  Multicast:                         372

  Broadcast:                      607,  Jumbo:                               0

  Discard:                          0,  Pause:                               0

  Frames:                           0

  Total Error:                      0

  CRC:                              0,  Giants:                              0

  Runts:                            0,  DropEvents:                          0

  Alignments:                       0,  Symbols:                             0

  Ignoreds:                         0

Output:  39962 packets, 5490082 bytes

  Unicast:                      23702,  Multicast:                       10219

  Broadcast:                     6041,  Jumbo:                               0

  Discard:                          0,  Pause:                               0

  Total Error:                      0

  Collisions:                       0,  Late Collisions:                     0

  Deferreds:                        0

    Input bandwidth utilization  :    0%

    Output bandwidth utilization :    0%

-----------------------------------------------------

PortName                      Status      Weight

-----------------------------------------------------

GigabitEthernet0/0/20         UP          1

GigabitEthernet0/0/19         UP          1

-----------------------------------------------------

The Number of Ports in Trunk : 2

The Number of UP Ports in Trunk : 2

四、验证

验证的方式较为简单,两个网卡同时插上网线,并连接到交换机上,断掉其中任何一个,不影响使用。

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号