计算机网络中的交换技术,计算机网络三种基本的交换技术

首页 > 农林牧渔 > 作者:YD1662024-01-07 07:06:54

二、交换配置实例 - VLAN、链路聚合、三层分类交换演示

计算机网络中的交换技术,计算机网络三种基本的交换技术(5)

2.1 接入层交换机为二层交换机配置如下(SW0为例,SW1/SW6/SW7类似)

<Huawei>system-view [Huawei]sysname SW0 #重命名交换机 [SW0]interface g 0/0/21 [SW0]vlan batch 10 20 [SW0]interface g 0/0/21 [SW0-GigabitEthernet0/0/21]port link-type access [SW0-GigabitEthernet0/0/21]port default vlan 10 #vlan 10配置 [SW0-GigabitEthernet0/0/21]quit [SW0]interface GigabitEthernet 0/0/22 [SW0-GigabitEthernet0/0/22]port link-type access [SW0-GigabitEthernet0/0/22]port default vlan 20 #vlan 20配置 [SW0-GigabitEthernet0/0/22]quit [SW0]interface Eth-Trunk 1 #eth-trunk 1配置 [SW0-Eth-Trunk1]mode lacp [SW0-Eth-Trunk1]max active-linknumber 4 [SW0-Eth-Trunk1]trunkport GigabitEthernet 0/0/1 to 0/0/4 [SW0-Eth-Trunk1]port link-type trunk [SW0-Eth-Trunk1]port trunk allow-pass vlan 10 20 [SW0-Eth-Trunk1]quit [SW0]quit

2.2 汇聚层交换机作为网关的配置(SW2为例,SW5类似)

<Huawei>system-view [Huawei]sysname sw2 #重命名交换机 [sw2]interface Eth-Trunk 1 #eth-trunk1配置,连接sw0 [sw2-Eth-Trunk1]mode lacp [sw2-Eth-Trunk1]max active-linknumber 4 [sw2-Eth-Trunk1]trunkport g 0/0/1 to 0/0/4 [sw2-Eth-Trunk1]port link-type trunk [sw2-Eth-Trunk1]port trunk allow-pass vlan 10 20 [sw2-Eth-Trunk1]quit [sw2]interface Eth-Trunk 2 #eth-trunk2配置,连接sw1 [sw2-Eth-Trunk2]mode lacp [sw2-Eth-Trunk2]max active-linknumber 4 [sw2-Eth-Trunk2]trunkport g 0/0/5 to 0/0/8 [sw2-Eth-Trunk2]port link-type trunk [sw2-Eth-Trunk2]port trunk allow-pass vlan 10 20 [sw2-Eth-Trunk2]quit [sw2]vlan batch 10 20 23 #网关配置 [sw2]interface Vlanif 10 [sw2-Vlanif10]ip address 10.10.2.254 24 [sw2-Vlanif10]quit [sw2]interface Vlanif 20 [sw2-Vlanif20]ip add 10.20.2.254 24 [sw2-Vlanif20]quit [sw2]interface Eth-Trunk 3 #eth-trunk3配置,连接sw3,使用access去除vlan标签 [sw2-Eth-Trunk3]mode lacp [sw2-Eth-Trunk3]quit [sw2]interface Eth-Trunk 3 [sw2-Eth-Trunk3]port link-type access [sw2-Eth-Trunk3]port default vlan 23 [sw2-Eth-Trunk3]mode lacp [sw2-Eth-Trunk3]quit [sw2]interface g 0/0/13 [sw2-GigabitEthernet0/0/13]eth-trunk 3 [sw2-GigabitEthernet0/0/13]quit [sw2]interface g 0/0/14 [sw2-GigabitEthernet0/0/14]eth-trunk 3 [sw2-GigabitEthernet0/0/14]interface g 0/0/15 [sw2-GigabitEthernet0/0/15]eth-trunk 3 [sw2-GigabitEthernet0/0/15]interface g 0/0/16 [sw2-GigabitEthernet0/0/16]eth-trunk 3 [sw2-GigabitEthernet0/0/16]quit [sw2]interface Vlanif 23 [sw2-Vlanif23]ip address 10.23.3.2 24 [sw2-Vlanif23]quit [sw2]ip route-static 10.11.5.0 24 10.23.3.3 #配置静态路由; [sw2]ip route-static 10.21.5.0 24 10.23.3.3 #实际应用中可以使用动态路由协议,更为灵活

2.3 核心层交换机,全部为路由配置(SW4为例,SW3类似)

<Huawei>system-view [Huawei]sysname sw4 #重命名路由器 [sw4]vlan batch 34 45 [sw4]interface vlanif 34 [sw4-Vlanif34]ip address 10.34.3.4 24 [sw4-Vlanif34]quit [sw4]interface eth-trunk 8 #配置trunk 8去除vlan标签 [sw4-Eth-Trunk8]port link-type access [sw4-Eth-Trunk8]port default vlan 34 [sw4-Eth-Trunk8]mode lacp [sw4-Eth-Trunk8]interface g 0/0/1 [sw4-GigabitEthernet0/0/1]eth-trunk 8 Info: This operation may take a few seconds. Please wait for a moment...done. [sw4-GigabitEthernet0/0/1]interface g 0/0/2 [sw4-GigabitEthernet0/0/2]eth-trunk 8 Info: This operation may take a few seconds. Please wait for a moment...done. [sw4-GigabitEthernet0/0/2]interface g 0/0/3 [sw4-GigabitEthernet0/0/3]eth-trunk 8 Info: This operation may take a few seconds. Please wait for a moment...done. [sw4-GigabitEthernet0/0/3]interface g 0/0/4 [sw4-GigabitEthernet0/0/4]eth-trunk 8 [sw4-GigabitEthernet0/0/4]quit [sw4]interface vlanif 45 [sw4-Vlanif45]ip address 10.5.4.4 24 [sw4-Vlanif45]quit [sw4]interface eth-trunk 3 [sw4-Eth-Trunk3]port link-type access [sw4-Eth-Trunk3]port default vlan 45 [sw4-Eth-Trunk3]mode lacp [sw4-Eth-Trunk3]interface g 0/0/13 [sw4-GigabitEthernet0/0/13]eth-trunk 3 #配置trunk3 去除vlan标签 [sw4-GigabitEthernet0/0/13]interface g 0/0/14 [sw4-GigabitEthernet0/0/14]eth-trunk 3 [sw4-GigabitEthernet0/0/14]interface g 0/0/15 [sw4-GigabitEthernet0/0/15]eth-trunk 3 [sw4-GigabitEthernet0/0/15]interface g 0/0/16 [sw4-GigabitEthernet0/0/16]eth-trunk 3 [sw4-GigabitEthernet0/0/16] [sw4-GigabitEthernet0/0/16]quit [sw4]interface vlanif 45 [sw4-Vlanif45]ip address 10.45.4.4 24 [sw4-Vlanif45]quit [sw4]ip route-static 10.10.2.0 24 10.34.3.3 #配置静态路由; [sw4]ip route-static 10.20.2.0 24 10.34.3.3 #实际应用中可以使用动态路由协议,更为灵活 [sw4]ip route-static 10.11.5.0 24 10.45.4.5 [sw4]ip route-static 10.21.5.0 24 10.45.4.5

2.4 PC配置(PC1为例,P2~PC8类似)

计算机网络中的交换技术,计算机网络三种基本的交换技术(6)

2.5 配置验证

[sw2]display eth-trunk Eth-Trunk1's state information is: Local: LAG ID: 1 WorkingMode: STATIC Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP System Priority: 32768 System ID: 4c1f-cc86-57c4 Least Active-linknumber: 1 Max Active-linknumber: 4 Operate status: up Number Of Up Port In Trunk: 4 -------------------------------------------------------------------------------- ActorPortName Status PortType PortPri PortNo PortKey PortState Weight GigabitEthernet0/0/1 Selected 1GE 32768 2 305 10111100 1 GigabitEthernet0/0/2 Selected 1GE 32768 3 305 10111100 1 GigabitEthernet0/0/3 Selected 1GE 32768 4 305 10111100 1 GigabitEthernet0/0/4 Selected 1GE 32768 5 305 10111100 1 Partner: -------------------------------------------------------------------------------- ActorPortName SysPri SystemID PortPri PortNo PortKey PortState GigabitEthernet0/0/1 32768 4c1f-cc97-779e 32768 2 305 10111100 GigabitEthernet0/0/2 32768 4c1f-cc97-779e 32768 3 305 10111100 GigabitEthernet0/0/3 32768 4c1f-cc97-779e 32768 4 305 10111100 GigabitEthernet0/0/4 32768 4c1f-cc97-779e 32768 5 305 10111100 Eth-Trunk2's state information is: Local: LAG ID: 2 WorkingMode: STATIC Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP System Priority: 32768 System ID: 4c1f-cc86-57c4 Least Active-linknumber: 1 Max Active-linknumber: 4 Operate status: up Number Of Up Port In Trunk: 4 -------------------------------------------------------------------------------- ActorPortName Status PortType PortPri PortNo PortKey PortState Weight GigabitEthernet0/0/5 Selected 1GE 32768 6 561 10111100 1 GigabitEthernet0/0/6 Selected 1GE 32768 7 561 10111100 1 GigabitEthernet0/0/7 Selected 1GE 32768 8 561 10111100 1 GigabitEthernet0/0/8 Selected 1GE 32768 9 561 10111100 1 Partner: -------------------------------------------------------------------------------- ActorPortName SysPri SystemID PortPri PortNo PortKey PortState GigabitEthernet0/0/5 32768 4c1f-cce5-6f14 32768 6 561 10111100 GigabitEthernet0/0/6 32768 4c1f-cce5-6f14 32768 7 561 10111100 GigabitEthernet0/0/7 32768 4c1f-cce5-6f14 32768 8 561 10111100 GigabitEthernet0/0/8 32768 4c1f-cce5-6f14 32768 9 561 10111100 Eth-Trunk3's state information is: Local: LAG ID: 3 WorkingMode: STATIC Preempt Delay: Disabled Hash arithmetic: According to SIP-XOR-DIP System Priority: 32768 System ID: 4c1f-cc86-57c4 Least Active-linknumber: 1 Max Active-linknumber: 8 Operate status: up Number Of Up Port In Trunk: 4 -------------------------------------------------------------------------------- ActorPortName Status PortType PortPri PortNo PortKey PortState Weight GigabitEthernet0/0/13 Selected 1GE 32768 14 817 10111100 1 GigabitEthernet0/0/14 Selected 1GE 32768 15 817 10111100 1 GigabitEthernet0/0/15 Selected 1GE 32768 16 817 10111100 1 GigabitEthernet0/0/16 Selected 1GE 32768 17 817 10111100 1 Partner: -------------------------------------------------------------------------------- ActorPortName SysPri SystemID PortPri PortNo PortKey PortState GigabitEthernet0/0/13 32768 4c1f-ccae-2d50 32768 14 817 10111100 GigabitEthernet0/0/14 32768 4c1f-ccae-2d50 32768 15 817 10111100 GigabitEthernet0/0/15 32768 4c1f-ccae-2d50 32768 16 817 10111100 GigabitEthernet0/0/16 32768 4c1f-ccae-2d50 32768 17 817 10111100

[sw3]display ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 10 Routes : 10 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.10.2.0/24 Static 60 0 RD 10.23.3.2 Vlanif23 10.11.5.0/24 Static 60 0 RD 10.34.3.4 Vlanif34 10.20.2.0/24 Static 60 0 RD 10.23.3.2 Vlanif23 10.21.5.0/24 Static 60 0 RD 10.34.3.4 Vlanif34 10.23.3.0/24 Direct 0 0 D 10.23.3.3 Vlanif23 10.23.3.3/32 Direct 0 0 D 127.0.0.1 Vlanif23 10.34.3.0/24 Direct 0 0 D 10.34.3.3 Vlanif34 10.34.3.3/32 Direct 0 0 D 127.0.0.1 Vlanif34 127.0.0.0/8 Direct 0 0 D 127.0.0.1 InLoopBack0 127.0.0.1/32 Direct 0 0 D 127.0.0.1 InLoopBack0

计算机网络中的交换技术,计算机网络三种基本的交换技术(7)

注:

1、如果需要隔离VLAN互访,可以使用ACL控制路由策略,参考

2、由于eNSP不支持堆叠和集群,本实例不包含跨设备聚合(实际使用中将拓扑中物理交换机替换为堆叠逻辑交换机即可);如需学习堆叠和集群配置,可以参考华为官网示例:https://support.huawei.com/enterprise/zh/doc/EDOC1000037064/cdb88956

上一页12末页

栏目热文

文档排行

本站推荐

Copyright © 2018 - 2021 www.yd166.com., All Rights Reserved.