拓撲:
1、爲sw01、sw02、sw03設置生成樹協議
sw01(config)#spanning-tree mode rapid-pvst
sw02(config)#spanning-tree mode rapid-pvst
sw03(config)#spanning-tree mode rapid-pvst
2、設置端口聚合(省略了一些無用的輸出)
1)sw01
sw01(config)#interface port-channel 1
sw01(config-if)#interface range f0/1-2
sw01(config-if-range)#switchport mode trunk
sw01(config-if-range)#
sw01(config-if-range)#channel-group 1 mode on
sw01(config-if-range)#
sw01(config-if-range)#exit
sw01(config)#interface port-channel 3
sw01(config-if)#interface range f0/5-6
sw01(config-if-range)#switchport mode trunk
sw01(config-if-range)#
sw01(config-if-range)#channel-group 3 mode on
sw01(config-if-range)#
sw01(config-if-range)#end
sw01#
%SYS-5-CONFIG_I: Configured from console by console
sw01#show spanning-tree
VLAN0001
Spanning tree enabled protocol rstp
Root ID Priority 32769
Address 0002.164A.39E2
This bridge is the root
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 32769 (priority 32768 sys-id-ext 1)
Address 0002.164A.39E2
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Po1 Desg FWD 9 128.27 Shr
Po3 Desg FWD 9 128.28 Shr
sw01#show etherchannel sum
sw01#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
1 Po1(SU) - Fa0/1(P) Fa0/2(P)
3 Po3(SU) - Fa0/5(P) Fa0/6(P)
2)sw02
(忘記保存項目了,只剩之前的截圖)
3)sw03
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname sw03
sw03(config)#spann
sw03(config)#spanning-tree mode ra
sw03(config)#spanning-tree mode rapid-pvst
sw03(config)#
sw03(config)#interface port-channel 2
sw03(config-if)#interface range f0/3-4
sw03(config-if-range)#switchport mode trunk
sw03(config-if-range)#
sw03(config-if-range)#channel-grou
sw03(config-if-range)#channel-group 2 mode on
sw03(config-if-range)#exit
sw03(config)#interface port-channel 3
sw03(config-if)#interface range f0/5-6
sw03(config-if-range)#switchport mode trunk
sw03(config-if-range)#channel-grou
sw03(config-if-range)#channel-group 3 mode on
sw03(config-if-range)#end
sw03#show etherchannel summ
sw03#show etherchannel summary
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
U - in use f - failed to allocate aggregator
u - unsuitable for bundling
w - waiting to be aggregated
d - default port
Number of channel-groups in use: 2
Number of aggregators: 2
Group Port-channel Protocol Ports
------+-------------+-----------+----------------------------------------------
2 Po2(SU) - Fa0/3(P) Fa0/4(P)
3 Po3(SU) - Fa0/5(P) Fa0/6(P)
3、配置vlan10、vlan20、vlan30,pc的ip
1)sw01
sw01>en
sw01#conf t
sw01(config)#vlan 10
sw01(config-vlan)#interface f0/11
sw01(config-if)#switchport mode access
sw01(config-if)#switchport access vlan 10
sw01(config-if)#exit
sw01(config)#vlan 30
sw01(config-vlan)#interface f0/10
sw01(config-if)#switchport mode access
sw01(config-if)#switchport access vlan 30
sw01(config-if)#end
sw01#
2)sw02
sw02>en
sw02#conf t
sw02(config)#vlan 10
sw02(config-vlan)#interface f0/11
sw02(config-if)#switchport mode access
sw02(config-if)#switchport access vlan 10
sw02(config-if)#exit
sw02(config)#vlan 20
sw02(config-vlan)#interface f0/10
sw02(config-if)#switchport mode access
sw02(config-if)#switchport access vlan 20
sw02(config-if)#end
sw02#
3)sw03
sw03>en
sw03#conf t
sw03(config)#vlan 20
sw03(config-vlan)#interface f0/10
sw03(config-if)#switchport mode access
sw03(config-if)#switchport access vlan 20
sw03(config-if)#exit
sw03(config)#vlan 30
sw03(config-vlan)#interface f0/11
sw03(config-if)#switchport mode access
sw03(config-if)#switchport access vlan 30
sw03(config-if)#end
sw03#show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/7, Fa0/8
Fa0/9, Fa0/12, Fa0/13, Fa0/14
Fa0/15, Fa0/16, Fa0/17, Fa0/18
Fa0/19, Fa0/20, Fa0/21, Fa0/22
Fa0/23, Fa0/24, Gig0/1, Gig0/2
20 VLAN0020 active Fa0/10
30 VLAN0030 active Fa0/11
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
sw03#
上面都需要配置一步:
no spanning-tree vlan 10
no spanning-tree vlan 20
no spanning-tree vlan 30
4、配置流量均衡
port-channel load-balance method
源地址src-ip
目的地址 dst-ip
源和目的地址 src-dst-ip
源mac地址 src-mac
目的mac地址 dst-mac
源和目的mac src-dst-mac
所以配置SW01基於源MAC地址,SW02基於目的MAC地址:
Sw01(config)#port-channel load-balance src-mac Sw02(config)#port-channel load-balance dst-mac
5、測試截圖
Vlan 10裏的PC5 ping PC0
Vlan 10裏的PC5 ping vlan 20裏的PC1