實驗 端口聚合配置
【實驗名稱】
端口聚合配置。
【實驗目的】
理解端口聚合的工作原理,掌握如何在交換機上配置端口聚合。
【背景描述】
假設某企業採用兩臺交換機組成一個局域網,由於很多數據流量是跨過交換機進行轉發
的,因此需要提高交換機之間的傳輸帶寬,並實現鏈路冗餘備份,爲此網絡管理員在兩臺交
換機之間採用兩根網線互連,並將相應的兩個端口聚合爲一個邏輯端口,現要在交換機上做
適當配置來實現這一目標。
【需求分析】
需要在兩臺交換機之間的冗餘鏈路上實現端口聚合,並且在聚合端口上設置 Trunk,以
增加網絡骨幹鏈路的帶寬。
【實驗拓撲】
圖 4‐ 2 實驗拓撲圖
按照拓撲圖連接網絡時注意,兩臺交換機都配置完端口聚合後,再將兩臺交換機連接
起來。如果先連線再配置可能會造成廣播風暴,影響交換機的正常工作。
【實驗設備】
三層交換機 1 臺
二層交換機 1 臺
【預備知識】
交換機的基本配置方法,VLAN 的工作原理和配置方法,Trunk 的工作原理和配置方法,
SVI 端口的配置方法,聚合端口的工作原理和配置方法
【實驗原理】
端口聚合(Aggregate-port)又稱鏈路聚合,是指兩臺交換機之間在物理上將多個端口
連接起來,將多條鏈路聚合成一條邏輯鏈路。從而增大鏈路帶寬,解決交換網絡中因帶寬引
起的網絡瓶頸問題。多條物理鏈路之間能夠相互冗餘備份,其中任意一條鏈路斷開,不會影
響其他鏈路的正常轉發數據。
端口聚合遵循 IEEE 802.3ad 協議的標準。
【實驗步驟】
第一步:配置兩臺交換機的主機名和管理 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
L3-SW(config)#
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
L2-SW(config)#
第三步:將聚合端口設置爲 Trunk
L3-SW(config)#interface aggregateport 1
L3-SW(config-if)#switchport mode trunk
L3-SW(config-if)#exit
L3-SW(config)#
L2-SW(config)#interface aggregatePort 1
L2-SW(config-if)#switchport mode trunk
L2-SW(config-if)#exit
L2-SW(config)#
第四步:設置聚合端口的負載平衡方式
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
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
L3-SW#
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
L2-SW#
第六步:驗證配置
在三層交換機 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)#
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
L2-SW(config)#ip default-gateway 192.168.1.1
!設置二層交換機的默認網關
L2-SW(config)#exit
L2-SW#
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,然後斷開聚合端口中的
Fa0/2 端口:
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 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
發現此時有一個丟包。這說明在實驗中設置的負載均衡方式下,同一對源和目的地址之
間的流量只從一個物理端口進行轉發,這個端口斷開時會將流量切換到另一個端口上,引起
了鏈路短暫的中斷。
【注意事項】
1、只有同類型端口才能聚合爲一個 AG 端口。
2、所有物理端口必須屬於同一個 VLAN。
3、在銳捷交換機上最多支持 8 個物理端口聚合爲一個 AG。
4、在銳捷交換機上最多支持 6 組聚合端口。
【參考配置】
L3-SW#show running-config
Building configuration...
Current configuration : 1378 bytes
!
version RGNOS 10.1.00(4), Release(18443)(Tue Jul 17 19:51:54 CST 2007 -ubu6server)
hostname L3-SW
!
vlan 1
!
vlan 10
!
interface FastEthernet 0/1
port-group 1
!
interface FastEthernet 0/2
port-group 1
!
interface FastEthernet 0/3
!
interface FastEthernet 0/4
!
interface FastEthernet 0/5
!
interface FastEthernet 0/6
!
interface FastEthernet 0/7
!
interface FastEthernet 0/8
!
interface FastEthernet 0/9
!
interface FastEthernet 0/10
!
interface FastEthernet 0/11
!
interface FastEthernet 0/12
!
interface FastEthernet 0/13
!
interface FastEthernet 0/14
!
interface FastEthernet 0/15
!
interface FastEthernet 0/16
!
interface FastEthernet 0/17
!
interface FastEthernet 0/18
!
interface FastEthernet 0/19
!
interface FastEthernet 0/20
!
interface FastEthernet 0/21
!
interface FastEthernet 0/22
!
interface FastEthernet 0/23
!
interface FastEthernet 0/24
!
interface GigabitEthernet 0/25
!
interface GigabitEthernet 0/26
!
interface GigabitEthernet 0/27
!
interface GigabitEthernet 0/28
!
interface AggregatePort 1
switchport mode trunk
!
interface VLAN 1
ip address 192.168.1.1 255.255.255.0
!
interface VLAN 10
ip address 192.168.10.1 255.255.255.0
!
aggregateport load-balance dst-mac
!
!
line con 0
line vty 0 4
login
!
end
L2-SW#show running-config
System software version : 1.68 Build Apr 25 2007 Release
Building configuration...
Current configuration : 347 bytes
!
version 1.0
!
hostname L2-SW
vlan 1
!
aggregateport load-balance dst-mac
interface aggregatePort 1
switchport mode trunk
!
interface fastEthernet 0/1
port-group 1
!
interface fastEthernet 0/2
port-group 1
!
interface vlan 1
no shutdown
ip address 192.168.1.2 255.255.255.0
!
ip default-gateway 192.168.1.1
end