链路聚合综合配置示例(路由器和路由器链路聚合---路由器和交换机链路聚合---交换机和交换机链路聚合)

本文介绍了静态LACP模式和手动负载均衡模式在链路聚合中的应用,包括路由器和交换机之间的链路聚合配置。在静态LACP模式中,部分链路作为备份,而在手动负载均衡模式下所有成员口都参与转发。文中提供了配置示例,展示了如何设置设备优先级和端口优先级来选择主设备和备份链路,以及如何通过配置实现网络带宽提升和链路冗余。此外,还提到了如何通过`displayeth-trunk`命令进行接口状态验证。
摘要由CSDN通过智能技术生成

        静态LACP链路聚合模式和手动负载均衡链路聚合模式的主要区别:在LACP模式中,一些链路充当备份链路;在手动负载均衡模式中,所有的成员口都处于转发状态。

一、示例展示的要点:

        1. 路由器和路由器链路聚合;

        2. 路由器和交换机链路聚合;

        3. 交换机和交换机链路聚合;

        4. 手动负载分担模式;

        5. 静态LACP模式(配置设备优先级用于选出主设备,配置端口优先级用于指定备份链路)。

二、示例场景

         为实现提高网络带宽和链路备份。

三、示例拓扑图

四、代码段

system-view
sysname R
ip route-static 192.168.20.0 24 1.1.1.2
interface Eth-Trunk 2
undo portswitch
mode lacp-static
trunkport GigabitEthernet 4/0/0 4/0/1
ip address 192.168.10.254 24
interface Eth-Trunk 1
undo portswitch
mode lacp-static
trunkport GigabitEthernet 0/0/0 0/0/1
ip address 1.1.1.1 28

system-view
sysname R1
ip route-static 192.168.10.0 24 1.1.1.1
interface Eth-Trunk 1
undo portswitch
mode lacp-static
trunkport GigabitEthernet 0/0/0 0/0/1
ip address 1.1.1.2 28
interface GigabitEthernet 2/0/1
ip address 192.168.20.254 24

system-view
sysname SW1
lacp priority 100
vlan 10
interface Eth-Trunk 3
mode lacp-static
port link-type trunk
port trunk allow-pass vlan 10
trunkport GigabitEthernet 0/0/1 to 0/0/3
max active-linknumber 2
interface GigabitEthernet 0/0/1
lacp priority 100
interface GigabitEthernet 0/0/2
lacp priority 100
interface Eth-Trunk 2
mode lacp-static
port link-type access 
port default vlan 10
trunkport GigabitEthernet 0/0/4 0/0/5

system-view
sysname SW2
vlan 10
interface Eth-Trunk 3
mode lacp-static
port link-type trunk
port trunk allow-pass vlan 10
trunkport GigabitEthernet 0/0/1 to 0/0/3
interface GigabitEthernet 0/0/4
port hybrid untagged vlan 10
port hybrid pvid vlan 10
interface GigabitEthernet 0/0/5
port link-type access
port default vlan 10

system-view
sysname SW3
vlan 20
interface Eth-Trunk 4
mode manual load-balance
port link-type trunk
port trunk allow-pass vlan 20
interface Ethernet0/0/1
eth-trunk 4
interface Ethernet0/0/2
eth-trunk 4
interface Ethernet0/0/3
eth-trunk 4
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 20

system-view
sysname SW4
vlan 20
interface Eth-Trunk 4
mode manual load-balance
port link-type trunk
port trunk allow-pass vlan 20
trunkport Ethernet 0/0/1 to 0/0/3
interface Ethernet 0/0/4
port link-type access
port default vlan 20
interface Ethernet 0/0/5
port hybrid untagged vlan 20
port hybrid pvid vlan 20

五、代码解释

<Huawei>system-view
[Huawei]sysname R
[R]ip route-static 192.168.20.0 24 1.1.1.2 //配置静态路由
[R]interface Eth-Trunk 2 //创建聚合链路端口2
[R-Eth-Trunk2]undo portswitch //将二层网络端口转换成三次网络端口
[R-Eth-Trunk2]mode lacp-static //设置聚合链路2为静态LACP模式
[R-Eth-Trunk2]trunkport GigabitEthernet 4/0/0 4/0/1 //将物理端口GE 4/0/0和GE 4/0/1添加到聚合链路2的端口中

[R-Eth-Trunk2]ip address 192.168.10.254 24
[R-Eth-Trunk2]interface Eth-Trunk 1
[R-Eth-Trunk1]undo portswitch
[R-Eth-Trunk1]mode lacp-static
[R-Eth-Trunk1]trunkport GigabitEthernet 0/0/0 0/0/1
[R-Eth-Trunk1]ip address 1.1.1.1 28

        注意:端口加入Eth-Trunk口时,二层Eth-Trunk口的成员口必须是二层端口,三层Eth-Trunk口的成员口必须是三层端口。

<Huawei>system-view
[Huawei]sysname R1
[R1]ip route-static 192.168.10.0 24 1.1.1.1 //配置静态路由
[R1]interface Eth-Trunk 1 //创建聚合链路端口1
[R1-Eth-Trunk1]undo portswitch //将二层网络端口转换成三次网络端口
[R1-Eth-Trunk1]mode lacp-static //设置聚合链路1为静态LACP模式
[R1-Eth-Trunk1]trunkport GigabitEthernet 0/0/0 0/0/1 //将物理端口GE 0/0/0和GE 0/0/1添加到聚合链路1的端口中
[R1-Eth-Trunk1]ip address 1.1.1.2 28

<Huawei>system-view
[Huawei]sysname SW1
[SW1]lacp priority 100 //设置SW1交换机lacp优先级为100
[SW1]vlan 10
[SW1-vlan10]interface Eth-Trunk 3 //创建聚合链路端口3
[SW1-Eth-Trunk3]mode lacp-static //设置聚合链路1为静态LACP模式
[SW1-Eth-Trunk3]port link-type trunk //设置聚合链路端口3的vlan端口链路类型为trunk
[SW1-Eth-Trunk3]port trunk allow-pass vlan 10 //设置聚合链路端口3允许vlan 10数据通过
[SW1-Eth-Trunk3]trunkport GigabitEthernet 0/0/1 to 0/0/3 //将物理端口GE 0/0/1、GE 0/0/2和GE 0/0/1添加到聚合链路1的端口中
[SW1-Eth-Trunk3]max active-linknumber 2 //设置活动链路上限数为2个
[SW1-Eth-Trunk3]interface GigabitEthernet 0/0/1
[SW1-GigabitEthernet0/0/1]lacp priority 100 //设置SW1交换机GE0/0/1端口lacp优先级为100
[SW1-GigabitEthernet0/0/1]interface GigabitEthernet 0/0/2
[SW1-GigabitEthernet0/0/2]lacp priority 100 //设置SW1交换机GE0/0/2端口lacp优先级为100
[SW1-GigabitEthernet0/0/2]interface Eth-Trunk 2  //创建聚合链路端口2
[SW1-Eth-Trunk2]mode lacp-static //设置聚合链路1为静态LACP模式
[SW1-Eth-Trunk2]port link-type access //设置聚合链路端口2的vlan端口链路类型为access
[SW1-Eth-Trunk2]port default vlan 10  //设置聚合链路端口2允许vlan 10数据通过
[SW1-Eth-Trunk2]trunkport GigabitEthernet 0/0/4 0/0/5  //将物理端口GE 0/0/4和GE 0/0/5添加到聚合链路2的端口中

<Huawei>system-view
[Huawei]sysname SW2
[SW2]vlan 10
[SW2-vlan10]interface Eth-Trunk 3   //创建聚合链路端口3
[SW2-Eth-Trunk3]mode lacp-static  //设置聚合链路1为静态LACP模式
[SW2-Eth-Trunk3]port link-type trunk //设置聚合链路端口3的vlan端口链路类型为trunk
[SW2-Eth-Trunk3]port trunk allow-pass vlan 10 //设置聚合链路端口3允许vlan 10数据通过
[SW2-Eth-Trunk3]trunkport GigabitEthernet 0/0/1 to 0/0/3  //将物理端口GE 0/0/1、GE 0/0/2和GE 0/0/1添加到聚合链路1的端口中
[SW2-Eth-Trunk3]interface GigabitEthernet 0/0/4
[SW2-GigabitEthernet0/0/4]port hybrid untagged vlan 10 //交换机在该端口转发VLAN10的帧时,剥离掉相应的VLAN Tag 10,以Untagged的方式发送出去。
[SW2-GigabitEthernet0/0/4]port hybrid pvid vlan 10 //设置Hybrid类型端口的VLAN ID,即该端口上接收到未带VLAN Tag的帧时,加上VLAN Tag 10再转发。
[SW2-GigabitEthernet0/0/4]interface GigabitEthernet 0/0/5
[SW2-GigabitEthernet0/0/5]port link-type access  //设置GE0/0/5的vlan端口链路类型为access
[SW2-GigabitEthernet0/0/5]port default vlan 10 //设置GE0/0/5允许vlan 10数据通过

<Huawei>system-view
[Huawei]sysname SW3
[SW3]vlan 20
[SW3-vlan20]interface Eth-Trunk 4   //创建聚合链路端口4
[SW3-Eth-Trunk4]mode manual load-balance //设置聚合链路4为手动负载分担模式
[SW3-Eth-Trunk4]port link-type trunk  //设置聚合链路端口4的vlan端口链路类型为trunk
[SW3-Eth-Trunk4]port trunk allow-pass vlan 20 //设置聚合链路端口4允许vlan 20数据通过
[SW3-Eth-Trunk4]interface Ethernet0/0/1
[SW3-Ethernet0/0/1]eth-trunk 4  //将物理端口E 0/0/1添加到聚合链路4的端口中
[SW3-Ethernet0/0/1]interface Ethernet0/0/2
[SW3-Ethernet0/0/2]eth-trunk 4 //将物理端口E 0/0/2添加到聚合链路4的端口中
[SW3-Ethernet0/0/2]interface Ethernet0/0/3
[SW3-Ethernet0/0/3]eth-trunk 4 //将物理端口E 0/0/3添加到聚合链路4的端口中
[SW3-Ethernet0/0/3]interface GigabitEthernet 0/0/1
[SW3-GigabitEthernet0/0/1]port link-type access //设置GE0/0/1的vlan端口链路类型为access
[SW3-GigabitEthernet0/0/1]port default vlan 20  //设置GE0/0/1允许vlan 20数据通过

<Huawei>system-view
[Huawei]sysname SW4
[SW4]vlan 20
[SW4-vlan20]interface Eth-Trunk 4
[SW4-Eth-Trunk4]mode manual load-balance
[SW4-Eth-Trunk4]port link-type trunk
[SW4-Eth-Trunk4]port trunk allow-pass vlan 20
[SW4-Eth-Trunk4]trunkport Ethernet 0/0/1 to 0/0/3
[SW4-Eth-Trunk4]interface Ethernet 0/0/4
[SW4-Ethernet0/0/4]port link-type access
[SW4-Ethernet0/0/4]port default vlan 20
[SW4-Ethernet0/0/4]interface Ethernet 0/0/5
[SW4-Ethernet0/0/5]port hybrid untagged vlan 20
[SW4-Ethernet0/0/5]port hybrid pvid vlan 20

六、测试验证

        使用display eth-trunk 命令查看Eth-Trunk 1接口状态,测试聚合链路备用端口切换启用。

         如果将SW1的GE 0/0/2端口down掉:

        开启SW1的GE 0/0/2端口:

         SW1的GE 0/0/2端口从故障状态恢复正常后,没有自动变成活动状态。


        使用display interface eth-trunk 命令查看Eth-Trunk 1接口信息

        Eth-Trunk 3为2G,是两个GE端口带宽之和,GE0/0/3接口为Eth-Trunk 3的备用接口。

参考链接:https://www.cnblogs.com/gucun-blog/p/16369443.html

http://t.csdn.cn/U9rZy

SNMP Exporter 是一种基于 SNMP 协议的 Exporter,可以采集 SNMP 设备的各种指标。要采集路由器交换机的内存利用率以及 cpu 利用率,需要先确定设备上对应的 OID(Object ID),然后在 SNMP Exporter 的配置文件中进行相应的配置。以下是一个简单的示例配置文件: ``` global: scrape_interval: 1m scrape_timeout: 10s scrape_configs: - job_name: 'snmp' scrape_interval: 30s static_configs: - targets: - router1.example.com - switch1.example.com metrics_path: /snmp params: module: [system,cpu,memory] relabel_configs: - source_labels: [__address__] target_label: __param_target - source_labels: [__param_target] target_label: instance - target_label: __address__ replacement: 10.0.0.1:9116 # SNMP Exporter 的地址 ``` 在该配置文件中,我们定义了一个名为 `snmp` 的监控任务,定期采集路由器交换机的指标。`targets` 指定了要监控的设备地址,`params` 则指定了要采集的模块,包括 `system`、`cpu` 和 `memory`。在 `relabel_configs` 中,我们使用了几个重写规则,将设备地址和采集参数加入到指标的标签中。 在正确配置了 SNMP Exporter 的情况下,Prometheus 就可以通过 `snmp` 任务来采集设备的 cpu 利用率和内存利用率等指标了。你可以使用类似以下的 PromQL 查询语句来查询这些指标: ``` 100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) * 100) ``` 该语句可以计算出设备的 CPU 利用率。对于内存利用率,可以使用类似以下的语句: ``` (node_memory_MemTotal_bytes - node_memory_MemFree_bytes - node_memory_Buffers_bytes - node_memory_Cached_bytes) / node_memory_MemTotal_bytes * 100 ``` 该语句计算出设备的内存已使用的百分比。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值