雏鹰部落

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 972|回复: 0

[讨论/求助] 链路聚合与stp

[复制链接]
发表于 2016-8-4 20:26:37 | 显示全部楼层 |阅读模式
本帖最后由 shuxiangping 于 2016-8-4 20:48 编辑

首先有必要介绍几个概念一、链路聚合
       链路聚合也称为端口捆绑、端口聚集或链路聚集。通过将多个物理链路捆绑为一个逻辑链路增加了带宽;提高了可靠性。当有一条链路断开,流量会自动在剩下的链路间重新分配。实现链路传输弹性和冗余。
二、stp
       1、概念
             stp协议是一个二层的链路管理协议,它在提供链路冗余的同时防止网路产生环路。stp通过生成树算法(SPA)生成一个没有环路的的网路,当主要链路通信出现故障时,能够自动切换到备份链路,保证网路的正常通信。
       2、作用
             避免产生环路。
       3、种类
            发送BPDU和其他交换机进行通信。
       4、生成树协议中的基本概念
            网桥号:用于标识网路中的每一台交换机,它由两部分组成,2字节优先级和6字节MAC组成。优先级从0-65535,缺省为32768.
            根网桥:具有最小网桥号的交换机被选为根网桥,根网桥的所有端口都是制定端口,都不会被阻塞
            根端口:整个网路中只有一个根网桥,根网桥上的端口都是指定端口。
            指定端口:每个非根网桥为每个连接的网路选出一个指定端口。


            选出指定端口后,再选出根端口基本上就可以确定阻塞端口了。
       5、工作过程
            5.1、根桥的选取
            5.2、确定根端口的指定端口
            5.3、阻塞
       6、根网桥选择过程
            全网选举网桥号BID最小的交换机为根网桥。
       7、指定端口和根端口选择过程
            7.1、指定端口(网段唯一)
                 7.1.1 cost
                 7.1.2 端口所在的网桥ID值最小的
                 7.1.3 直连网桥的端口ID值最小的
                 注意:根桥上的所有端口全是指定端口
           7.2、根端口(非根桥唯一)
                 7.2.1、cost小的
                 7.2.2、直连网桥的BID小的
                 7.2.3、直连网桥的PID小的
       8、端口状态
          8.1、阻塞
          8.2、侦听
          8.3、学习
          8.4、转发
          8.5、无效
三、网路拓扑图
   
四、配置过程

sw1:
sw1#show running-config
Building configuration...

Current configuration : 1806 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname sw1
!
!
!
!
!
!
!
ip routing
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
vtp mode transparent
!
spanning-tree mode pvst
spanning-tree vlan 8,10-11 priority 0
!
!
!
!
!
!
vlan 8
!
vlan 10
!
vlan 11
!
interface Port-channel 2
switchport mode trunk
!
interface Port-channel 12
!
interface FastEthernet0/1
channel-group 2 mode on
switchport trunk encapsulation dot1q
switchport mode trunk
shutdown
!
interface FastEthernet0/2
channel-group 2 mode on
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan8
ip address 192.168.8.129 255.255.255.128
!
interface Vlan10
ip address 192.168.10.1 255.255.255.0
!
interface Vlan11
ip address 192.168.11.1 255.255.255.0
!
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
logging synchronous
privilege level 15
!
line aux 0
!
line vty 0 4
no login
privilege level 15
!
!
!
end
---------------------
sw2:
sw2#show running-config
Building configuration...

Current configuration : 1675 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname sw2
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
!
no ip domain-lookup
!
!
vtp mode transparent
!
spanning-tree mode pvst
spanning-tree vlan 8,10-11 priority 4096
!
!
!
!
!
!
vlan 8
!
vlan 10
!
vlan 11
!
interface Port-channel 2
switchport mode trunk
!
interface FastEthernet0/1
channel-group 2 mode on
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/2
channel-group 2 mode on
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/3
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
!
interface FastEthernet0/11
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan8
ip address 192.168.8.130 255.255.255.128
!
ip default-gateway 192.168.8.129
ip classless
!
ip flow-export version 9
!
!
!
!
!
!
!
line con 0
logging synchronous
privilege level 15
!
line aux 0
!
line vty 0 4
no login
privilege level 15
!
!
!

end
------------
sw3:
sw3#show running-config
Building configuration...

Current configuration : 1477 bytes
!
version 12.2
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname sw3
!
!
!
no ip domain-lookup
!
vtp mode transparent
!
!
spanning-tree mode pvst
!
vlan 8
!
vlan 10
!
vlan 11
!
interface FastEthernet0/1
switchport mode trunk
shutdown
!
interface FastEthernet0/2
switchport mode trunk
!
interface FastEthernet0/3
!
interface FastEthernet0/4
!
interface FastEthernet0/5
!
interface FastEthernet0/6
!
interface FastEthernet0/7
!
interface FastEthernet0/8
!
interface FastEthernet0/9
!
interface FastEthernet0/10
switchport access vlan 10
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/11
switchport access vlan 11
switchport mode access
spanning-tree portfast
!
interface FastEthernet0/12
!
interface FastEthernet0/13
!
interface FastEthernet0/14
!
interface FastEthernet0/15
!
interface FastEthernet0/16
!
interface FastEthernet0/17
!
interface FastEthernet0/18
!
interface FastEthernet0/19
!
interface FastEthernet0/20
!
interface FastEthernet0/21
!
interface FastEthernet0/22
!
interface FastEthernet0/23
!
interface FastEthernet0/24
!
interface GigabitEthernet0/1
!
interface GigabitEthernet0/2
!
interface Vlan1
no ip address
shutdown
!
interface Vlan8
ip address 192.168.8.131 255.255.255.128
!
ip default-gateway 192.168.8.129
!
!
!
!
line con 0
logging synchronous
privilege level 15
!
line vty 0 4
no login
privilege level 15
line vty 5 15
login
!
!

end




五、ping测试
当pc1 ping pc2时,会根据sw3的端口状态来选取


相关知识:

1、line console 0 可以设置控制台的一些状态,比如在line console 0可以设置exec-timeout和logging synchronous,前者可以设置不输入命令多长时间系统弹出,而后一个命令则可以设置在输入命令时不会被系统日志消息打断。而在console里加密是为了防止有其他非授权用户通过console口访问路由器或者交换机
2、channel-group [num] mode [auto | on | desirable]auto:被动协商;on:不协商;desirable:主动协商。
on只能和on起channel,两个auto不能起channel。

______________________________
channel-group 1 mode on是创建一个channel并设置模式
channel-group 1是单个接口加入已存在的channel
3、SW2(config-if-range)#channel-group 2 mode on//手动捆绑:组2
SW1#show etherchannel summary   //查看以太网通道信息
4、1.Fa0/2为阻塞状态时,数据流只从Fa0/1进出,不经过Fa0/2物理接口。Fa0/1shutdown后,Fa0/2进入转发状态,数据流从Fa0/2进出。(以PC1PingPC2为例)
5、//Fa0/2为阻塞端口时,PC1ping 通PC2,数据流经过Fa0/1端口。
    //Fa0/1shutdown 后,PC2在一段时间内,出现丢包现象(这段时间判断Fa0/1端口是否Down,然后作出相应的决策,使Fa0/2进入转发状态)


6、用stp解释实验过程:sw1的优先级被手动定为0,sw2被指定为4096,而sw3缺省为你32768.因此sw1的bid最小,确定为根网桥。然后我们知道sw1的三个端口都为指定端口(网段唯一),所以我们开始选取非根网桥的根端口(非根网桥唯一),对于sw3,到达sw1(根网桥)的最小路径f0/1与f0/2比较,选举f0/1为根端口,同理我们得出sw2的f0/3为指定端口,f0/1和f0/2为根端口,sw3的f0/2为阻塞端口


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|熊猫同学技术论坛|小黑屋| 网络工程师论坛 ( 沪ICP备09076391 )

GMT+8, 2024-4-25 14:28 , Processed in 0.082225 second(s), 20 queries , Gzip On.

快速回复 返回顶部 返回列表