端口聚合配置-改版
实验1-4 端口聚合配置-改版
【实验名称】
端口聚合配置。
【实验目的】
理解端口聚合的工作原理,掌握如何在交换机上配置端口聚合。
【背景描述】
假设某企业采用两台交换机组成一个局域网,由于很多数据流量是跨过交换机进行转发的,因此需要提高交换机之间的传输带宽,并实现链路冗余备份,为此网络管理员在两台交换机之间采用两根网线互连,并将相应的两个端口聚合为一个逻辑端口,现要在交换机上做适当配置来实现这一目标。
【需求分析】
需要在两台交换机之间的冗余链路上实现端口聚合,并且在聚合端口上设置 Trunk,以增加网络骨干链路的带宽。
【实验拓扑】
按照拓扑图连接网络时注意,两台交换机都配置完端口聚合后,再将两台交换机连接起来。如果先连线再配置可能会造成广播风暴,影响交换机的正常工作。
【实验设备】
三层交换机 1 台
二层交换机 1 台
PC 2台
【预备知识】
交换机的基本配置方法,VLAN 的工作原理和配置方法,Trunk 的工作原理和配置方法,SVI 端口的配置方法,聚合端口的工作原理和配置方法
【实验原理】
端口聚合(Aggregate-port)又称链路聚合,是指两台交换机之间在物理上将多个端口连接起来,将多条链路聚合成一条逻辑链路。从而增大链路带宽,解决交换网络中因带宽引起的网络瓶颈问题。多条物理链路之间能够相互冗余备份,其中任意一条链路断开,不会影响其他链路的正常转发数据。端口聚合遵循 IEEE 802.3ad 协议的标准。
【实验步骤】
本实验图片(比拓扑图难度高一点,增加了pc终端):
按照图连接好设备(不知道如何选线的请看前面发布的相关内容)。
第一步:配置两台交换机的主机名和管理 IP 地址
S3750#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
S3750(config)#hostname L3-SW
L3-SW(config)#interface vlan 1
L3-SW(config-if)#Dec 3 01:03:22 L3-SW %7:%LINE PROTOCOL CHANGE:
Interface VLAN 1, changed state to UP
L3-SW(config-if)#ip address 192.168.1.1 255.255.255.0
L3-SW(config-if)#no shutdown
L3-SW(config-if)#exit
操作图展示如下:
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname L2-SW
L2-SW(config)#interface vlan 1
L2-SW(config-if)#ip address 192.168.1.2 255.255.255.0
L2-SW(config-if)#no shutdown
L2-SW(config-if)#exit
操作图展示如下:
第二步:在两台交换机上配置聚合端口
L3-SW(config)#interface range fastEthernet 0/1-2
L3-SW(config-if-range)#port-group 1
!将端口 Fa0/1~2 加入聚合端口 1,同时创建该聚合端口
L3-SW(config-if-range)#Dec 3 01:03:57 L3-SW %7:%LINE PROTOCOL CHANGE:
Interface AggregatePort 1, changed state to UP
Dec 3 01:03:58 L3-SW %7:%LINK CHANGED: Interface FastEthernet 0/1, changed
state to administratively down
Dec 3 01:03:58 L3-SW %7:%LINE PROTOCOL CHANGE: Interface FastEthernet
0/1, changed state to DOWN
Dec 3 01:03:58 L3-SW %7:%LINK CHANGED: Interface FastEthernet 0/2, changed
state to administratively down
L3-SW(config-if-range)#exit
聚合端口配置操作如下(图片展示的是思科模拟器相应版本的代码示例):
模拟器代码粘贴如下:
Switch(config)#interface range fastEthernet 0/1-2
Switch(config-if-range)#channel-group 1 mode on
L2-SW(config)#interface range fastEthernet 0/1-2
L2-SW(config-if-range)#port-group 1
!将端口 Fa0/1~2 加入聚合端口 1,同时创建该聚合端口
L2-SW(config-if-range)#exit
聚合端口配置操作如下(图片展示的是思科模拟器相应版本的代码示例):
第三步:将聚合端口设置为 Trunk
L3-SW(config)#interface aggregateport 1
L3-SW(config-if)#switchport mode trunk
L3-SW(config-if)#exit
交换机操作如下图所示(图片展示的是思科模拟器相应版本的代码示例):
模拟器代码粘贴如下:
Switch(config)#interface port-channel 1
Switch(config-if)#switchport mode trunk
Switch(config)#interface port-channel 1
Switch(config-if)#switchport trunk encap dot1q
Switch(config-if)#switch mode trunk
Switch(config-if)#exit
L2-SW(config)#interface aggregatePort 1
L2-SW(config-if)#switchport mode trunk
L2-SW(config-if)#exit
交换机操作如下图所示(图片展示的是思科模拟器相应版本的代码示例):
第四步:设置聚合端口的负载平衡方式
L3-SW(config)#aggregateport load-balance ?
!查看交换机支持的负载平衡方式
dst-ip Destination IP address
dst-mac Destination MAC address
ip Source and destination IP address
src-dst-mac Source and destination MAC address
src-ip Source IP address
src-mac Source MAC address
L3-SW(config)#aggregateport load-balance dst-mac
!设置负载平衡方式为依据目的地址进行,默认是依据源和目的地址
L3-SW(config)#exit
交换机操作图如下:
模拟器代码粘贴如下:
Switch#en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#interface port-channel 1
Switch(config-if)#port-channel load-balance dst-ip
Switch(config)#exit
L2-SW(config)#aggregatePort load-balance ?
!查看交换机支持的负载平衡方式
dst-mac Destination MAC address
ip Source and destination IP address
src-mac Source MAC address
L2-SW(config)#aggregatePort load-balance dst-mac
!设置负载平衡方式为依据目的地址进行,默认是依据源地址
L2-SW(config)#exit
交换机操作图如下:
第五步:查看聚合端口的配置
L3-SW#show aggregatePort load-balance
Load-balance : Destination MAC
L3-SW#
L3-SW#show aggregatePort summary
AggregatePort MaxPorts SwitchPort Mode Ports
Ag1 8 Enabled TRUNK Fa0/1 ,Fa0/2
L3-SW#
L3-SW#show interfaces aggregateport 1
Index(dec):29 (hex):1d
AggregatePort 1 is UP , line protocol is UP
Hardware is Aggregate Link AggregatePort
Interface address is: no ip address
MTU 1500 bytes, BW 1000000 Kbit
Encapsulation protocol is Bridge, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: WFQ
Switchport attributes:
interface's description:""
medium-type is copper
lastchange time:337 Day: 1 Hour: 3 Minute:56 Second
Priority is 0
admin duplex mode is AUTO, oper duplex is Full
admin speed is AUTO, oper speed is 100M
flow control admin status is AUTO,flow control oper status is OFF
broadcast Strom Control is OFF,multicast Strom Control is OFF,unicast Strom
Control is OFF
Aggregate Port Informations:
Aggregate Number: 1
Name: "AggregatePort 1"
Refs: 2
Members: (count=2)
FastEthernet 0/1 Link Status: Up
FastEthernet 0/2 Link Status: Up
交换机操作图如下:
模拟器代码粘贴如下:
Switch#show etherchannel summary
L2-SW#show aggregatePort load-balance
Load-balance : Destination MAC address
L2-SW#
L2-SW#show aggregatePort summary
AggregatePort MaxPorts SwitchPort Mode Ports
Ag1 8 Enabled Trunk Fa0/1 , Fa0/2
L2-SW#
L2-SW#show interfaces aggregatePort 1
Interface : AggregatePort 1
Description :
AdminStatus : up
OperStatus : up
Hardware : -
Mtu : 1500
LastChange : 0d:0h:0m:0s
AdminDuplex : Auto
OperDuplex : Full
AdminSpeed : Auto
OperSpeed : 100
FlowControlAdminStatus : Off
FlowControlOperStatus : Off
Priority : 0
Broadcast blocked :DISABLE
Unknown multicast blocked :DISABLE
Unknown unicast blocked :DISABLE
交换机操作图如下:
第六步:验证配置
在三层交换机 L3-SW 上配置另一个用于测试的 VLAN 10,配置 IP 地址为
192.168.10.1/24,然后在二层交换机 L2-SW 上配置默认网关(其作用相当于主机的网关,
交换机可将发往其他网段的数据包提交给网关处理),这样 L2-SW 可以 ping 通
192.168.1.1/24 和 192.168.10.1/24,说明聚合端口的 Trunk 配置已经生效。
L3-SW(config)#vlan 10
L3-SW(config-vlan)#exit
L3-SW(config)#interface vlan 10
L3-SW(config-if)#iDec 3 01:16:02 L3-SW %7:%LINE PROTOCOL CHANGE:
Interface VLAN 10, changed state to UP
L3-SW(config-if)#ip address 192.168.10.1 255.255.255.0
L3-SW(config-if)#no shutdown
L3-SW(config-if)#exit
操作图如下:
增加vlan10:
设置IP:
L2-SW(config)#ip default-gateway 192.168.1.1
!设置二层交换机的默认网关
操作图如下:
L2-SW#ping 192.168.1.1
Sending 5, 100-byte ICMP Echos to 192.168.1.1,
timeout is 2000 milliseconds.
!!!!!
Success rate is 100 percent (5/5)
Minimum = 1ms Maximum = 1ms, Average = 1ms
操作图如下:
L2-SW#ping 192.168.10.1
Sending 5, 100-byte ICMP Echos to 192.168.10.1,
timeout is 2000 milliseconds.
!!!!!
Success rate is 100 percent (5/5)
Minimum = 1ms Maximum = 1ms, Average = 1ms
操作图如下:
在三层交换机 L3-SW 上长时间的 ping 二层交换机 L2-SW,然后断开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!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 100 percent (1000/1000), round-trip min/avg/max = 1/1/10 ms
操作图如下:
可以看到在断开聚合端口中的 Fa0/2 端口时是没有丢包的。
再次实验,此次断开 Fa0/1端口:
L3-SW#ping 192.168.1.2 ntimes 1000
Sending 1000, 100-byte ICMP Echoes to 192.168.1.2, timeout is 2 seconds:
< press Ctrl+C to break >
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Success rate is 99 percent (999/1000), round-trip min/avg/max = 1/1/10 ms
操作图如下:
发现此时有丢包。
这说明在实验中设置的负载均衡方式下,同一对源和目的地址之间的流量只从一个物理端口进行转发,这个端口断开时会将流量切换到另一个端口上,引起了链路短暂的中断。
第七步:配置pc:
先在三层交换机上划分vlan20,vlan30:
划分vlan20:
划分vlan30:
配置IP:
pc0配置:
pc1配置:
分别在pc0上ping二层交换机和在pc1上ping二层交换机:
操作图如下:
pc0上ping二层交换机:
pc1上ping二层交换机:
【注意事项】
1、只有同类型端口才能聚合为一个 AG 端口。
2、所有物理端口必须属于同一个 VLAN。 3、在锐捷交换机上最多支持 8 个物理端口聚合为一个 AG。 4、在锐捷交换机上最多支持 6 组聚合端口。