华为交换机配置端口聚合(对应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

四、验证

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

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 2
    评论
解读下列编译报错:[OHOS INFO] ERROR at //build/templates/cxx/cxx.gni:242:7: Script returned non-zero exit code. [OHOS INFO] exec_script(external_deps_script, arguments) [OHOS INFO] ^---------- [OHOS INFO] Current dir: /home/huangjianli/kh3.2/out/khdvk_rk3568_a/ [OHOS INFO] Command: /usr/bin/env /home/huangjianli/kh3.2/build/templates/common/external_deps_handler.py --external-deps eventhandler:libeventhandler ces_standard:cesfwk_innerkits hiviewdfx_hilog_native:libhilog --parts-src-flag-file build_configs/parts_src_flag.json --external-deps-temp-file gen/kaihong/communication/kh_iotsdk/src/bonding/kh_iotsdk__bondingtest_external_deps_temp.json --sdk-base-dir ../../sdk/ohos-arm --sdk-dir-name sdk/ohos-arm --current-toolchain //build/toolchain/ohos:ohos_clang_arm --innerkits-adapter-info-file ../../build/ohos/inner_kits_adapter.json [OHOS INFO] Returned 1 and printed out: [OHOS INFO] [OHOS INFO] file '../../sdk/ohos-arm/ces_standard/sdk_info.json' doesn't exist. [OHOS INFO] [OHOS INFO] stderr: [OHOS INFO] [OHOS INFO] Traceback (most recent call last): [OHOS INFO] File "/home/huangjianli/kh3.2/build/templates/common/external_deps_handler.py", line 248, in <module> [OHOS INFO] sys.exit(main()) [OHOS INFO] File "/home/huangjianli/kh3.2/build/templates/common/external_deps_handler.py", line 214, in main [OHOS INFO] sdk_module_info, adapted_ok = _get_external_module_from_sdk( [OHOS INFO] File "/home/huangjianli/kh3.2/build/templates/common/external_deps_handler.py", line 73, in _get_external_module_from_sdk [OHOS INFO] raise Exception("part '{}' doesn't exist in sdk modules.".format( [OHOS INFO] Exception: part 'ces_standard' doesn't exist in sdk modules. [OHOS INFO] [OHOS INFO] See //kaihong/communication/kh_iotsdk/src/bonding/BUILD.gn:16:1: whence it was called. [OHOS INFO] ohos_executable("bondingtest") { [OHOS INFO] ^------------------------------- [OHOS INFO] See //kaihong/communication/kh_iotsdk/BUILD.gn:123:7: which caused the file to be included. [OHOS INFO] "//kaihong/communication/kh_iotsdk/src/bonding:bondingtest", [OHOS INFO] ^----------------------------------------------------------
06-08

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

归海听雪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值