交换机的基础知识
VLAN
1:VLAN 1.1 作用
VLAN 是2层广播隔离技术。 VLAN 具有安全性。
1)由于不同的VLAN 相互间是不可以访问的,因此可以按部门划分VLAN ,这样就可以保证部门间的安全性。 2)VACL
VLAN 可以变成SVI 接口参与路由。 (SVI:交换机虚拟端口)
一定特别的关注SVI 的状态,是否是UP UP SVI 端口可能的非UP UP 的情况和排除方法:
1) 就是该VLAN 没有包含任何属于激活状态的物理端口
R1 1 1.1.1.2/24 R2 2 1.1.1.3/24
VLAN 100 1.1.1.1/24
2)当前SWITCH 没有任何处于激活状态的TRUNK 。 3)管理员人为的把VLAN 变成SVI 后,设置SHUTDOWN
1.2VLAN 的范围
1~4094 DOT1Q TRUNK 12BIT 空间表示VLAN 的范围 1~1024 ISL TRUNK 10 BIT 空间表示VLAN 的范围
1 native vlan by default (可以修改~~接口下,利用命令行进行修改),NON TAG。 2~1001
1002~1005 保留VLAN ,FDDI 。
1006~4096 拓展VLAN ,看具体的设备的平台。
Switch#show vlan
VLAN Name Status Ports ---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4 Fa0/5, Fa0/6, Fa0/7, Fa0/8 Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Gi0/1, Gi0/2 2 VLAN2 active fa0/23
1002 fddi-default act/unsup 1003 token-ring-default act/unsup 1004 fddinet-default act/unsup 1005 trnet-default act/unsup 2~1001 这些编号的VLAN 是可以配置,修改和删除。
Dele vlan.dat 特权模式下利用该命令删除VLAN 的配置文件
2:VLAN 实施 2.1 LOCAL VLAN
当用户连接着交换机的某个端口,那么当该端口隶属特定VLAN 时,这个用户就隶属这个VLAN 。
用于的物理位置如果发生变化,那么用户的VLAN 角色就可能发生变化。 SW1 2(VLAN 2) 3(VLAN3) PC1 ----2---VLAN2 PC2----3---VLAN 3
2.2 END TO END VLAN
用户的物理位置无论怎么变,用户的VLAN 角色都不会变。 DOT1X----认证机制。
AAA 机制---认证 授权 记账 PC1---port--setp 1 :authentication
2:authorization VLAN 3:ACCOUNTING
3:VLAN 配置、查看、排错。
3.1.1 C3550 /C3560 configuration vlan Step 1: configure terminal Step 2:vlan number Step 3:name xxx
SW1(config)#vlan 100
SW1(config-vlan)#name VLAN_100 SW1(config-vlan)#vlan 200
SW1(config-vlan)#name vlan_200 SW1(config-vlan)# SW1(config-vlan)#end SW1#VLAN DATA
% Warning: It is recommended to configure VLAN from config mode, as VLAN database mode is being deprecated. Please consult user documentation for configuring VTP/VLAN in config mode.
3.1.2 C2950/C2948/C2960 configuration vlan
Step 1: vlan database
Step 2:vlan num (name xxxx) vlan 0001 Step 3:apply /exit
3.2:端口加入VLAN Step 1:interface xx Step 2:shutdown
Step3: switchport mode access
Switch 上所有端口基本都是ACCESS ,模式,ACCESS 模式就是所谓接入模式,这个模式等于告诉用户,这个端口可以直接相互的互联通讯,也可以连接用户设备并且和设备通讯,但是这个端口在3层交换机上是不可以加IP 参与路由。你需要在端口下输入no switchport 命令,将端口从2层升级为3层,然后才可以加IP 并且参与路由。 Step 43:switchport access vlan xx Step 54:no shutdown
Show vlan | include active Show ip int br
端口1 ~5 加入VLAN 2
Interface range fa 0/1-5 Sw mo ac Sw ac vlan 2
端口1,3,5 加入VLAN 2
Interface range fa 0/1,fa 0/3,fa 0/5 Sh
Sw mo ac Sw ac vlan 2 No sh
VLAN 名称 Vlan xx
Name VLAN_A TRUNK
1:TRUNK 作用
用来承载和传输不同VLAN 数据帧的。
2:如何配置TURNK
1. Enter interface configuration mode. 2. Shut down interface.
3. Select the encapsulation (802.1Q or ISL ). 4. Configure the interface as a Layer 2 trunk. 5. Specify the trunking native VLAN (for 802.1Q). 6. Configure the allowable VLANs for this trunk. 7. Disable dtp 关闭DTP
8. Use the no shutdown command on the interface to
activate the trunking process. 9. Verify the trunk configuration.
Show interface trunk
通过如上就可以查看这个TRUNK 的配置信息。
802.1Q 研发了NATIVE VLAN ISL 被迫接受了小巨人frame isl
4:配置
Switch(config)#interface fastethernet 5/8
Switch(config-if)#shutdown
Switch(config-if)#switchport trunk encapsulation dot1q Switch(config-if)#switchport trunk allowed vlan remove 13 Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk native vlan 99 Switch(config-if)#switchport nonegotiate 关闭DTP 。 Switch(config-if)#no shutdown
vlan dot1q tag native
敲在全局模式(让native vlan 打上标记)
4.1 编辑TRUNK 承载列表
SW1#show int trunk
Port Mode Encapsulation Status Native vlan Fa0/19 desirable n-isl trunking 1 Fa0/20 desirable n-isl trunking 1 Fa0/21 desirable n-isl trunking 1 Fa0/22 desirable n-isl trunking 1 Fa0/23 desirable n-isl trunking 1 Fa0/24 desirable n-isl trunking 1
Port Vlans allowed on trunk Fa0/19 1-4094 TRUNK 承载列表
SW1(config-if)#switchport trunk allowed vlan ?
WORD VLAN IDs of the allowed VLANs when this port is in trunking mode add add VLANs to the current list all all VLANs
except all VLANs except the following none no VLANs
remove remove VLANs from the current list
None 意思是该TRUNK 接口不允许任何VLAN 通过 Port Vlans allowed on trunk Fa0/19 none
Remove 意思是该VLAN 将被从TRUNK 承载列表中移除, 不允许该VLAN 从当前链路中互相通讯 把VLAN 1 移除
Port Vlans allowed on trunk Fa0/19 2-4094
Except 意思是除了指定的VLAN ,其他VLAN 都可以从该TRUNK 接口通过 SW1(config-if)#switchport trunk allowed vlan except 2 Port Vlans allowed on trunk Fa0/19 1,3-4094
ADD 意思是将指定VLAN 添加到当前TRUNK 的承载列表中 SW1(config-if)#switchport trunk allowed vlan add 2 Port Vlans allowed on trunk Fa0/19 1-4094
要求当前FA 0/19号接口,只允许1 3 5 7 9 VLAN 被放入承载列表(最少命令行实现)
interface FastEthernet0/19
switchport trunk allowed vlan none (可以不用敲的,如果是较早版本的IOS 是必须敲的)
switchport trunk allowed vlan 1,3,5,7,9 switchport mode dynamic desirable end
在考试的时候要特别注意,TRUNK 承载列表是否被错误的编辑过
4.2 修改NATIVE VLAN
If)# sw trunk native vlan xx
将FA 0/19号端口的NATIVE VLAN 改为2
SW1(config-if)#sw tr na vlan 2 SW1(config-if)#do sh int trunk
Port Mode Encapsulation Status Native vlan Fa0/19 desirable n-isl trunking 2
VLAN 1 作为默认的NATIVE VLAN ,本身没有TAG ,但现在NATIVE 不在是VLAN 1,此时VLAN 1 就必须有TAG 。
4.3 关闭DTP
SW1(config-if)#do sh int trunk
Port Mode Encapsulation Status Native vlan Fa0/19 desirable n-isl trunking 2
如果DTP 是被开启,那么当前交换机会自动建立直连LINK 的TRUNK ,而且你会发现TRUNK 接口的mode 是desirable, 封装标准为N-ISL
SW1#show int fa 0/19 switchport Name: Fa0/19
Switchport: Enabled
Administrative Mode: dynamic desirable Operational Mode: trunk
Administrative Trunking Encapsulation: negotiate Operational Trunking Encapsulation: isl
Negotiation of Trunking: On 通过这样的信息提示,管理员可以判定DTP 是被开启还是被关闭
5:DTP 动态TRUNK 协商协议
DTP 是根据我们的DTP 默认设置的协商参数来决定是否将互联端口协商成TRUNK LINK ,在通常情况下,其结果是协商成TRUNK LINK ,但是特殊情况下是协商成ACCESS ,或者是出错。
SW1-fa 0/0(d)----fa0/0(a)-SW2 Access Trunk
DTP 默认是开启,动态协商和判断当前接口模式是ACCESS 还是TRUNK 。 5.1
DTP desirable DTP MESSAGE
DTP auto
5.3:
Switchport mode access/trunk
Switchport mode dynamic desirable /auto
switchport nonegotiate 关闭DTP
实际上在考试和工程中,只要交换机端口开启了DTP ,那么当前设备就有可能已经拥有了TRUNK LINK。
VLAN 间路由 1:单臂路由
2:SVI
3:三层端口
注意是否开启路由功能 PVLAN
PVLAN 分为三种VLAN :
1)主VLAN primay
2)团体VLAN community
属于相同团体VLAN 之间的成员可以互相通讯,但是不可以跟其他的VLAN 通讯(混杂端口除外)
3)独立VLAN isolate
属于独立VLAN 之间的成员是不可以互相通讯的,同样不可以跟其他的VLAN 通讯(混杂端口除外) VTP
1:VTP 作用
VTP 是基于TRUNK ,VTP 的消息也是需要通过TRUNK 来承载的。 VTP 用来同步VLAN 配置信息给于远程设备。
Remote device 必须和本地的VTP 具有相同参数设置 VTP DOMAIN VTP PASSWORD
2:VTP MODE
2.1 server (by default)
所有交换机默认的VTP 参数: VTP MODE SERVER VTP DOMAIN 空 VTP PASS 空
VTP PRUNING 关闭 VTP TRAP 关闭
当前模式可以添加修改删除VLAN 信息。并且会将这些配置信息保存在NVRAM (非易失性RAM ),并且可以发送通告同步别人,以及接受通告被人同步。 VTP 配置修订号用于设备间VLAN 信息的同步。
VTP 配置修订号,默认是0,那么管理员每次对VLAN 的配置和修改以及删除,都会让该修订号增加1
在配置VTP 时,首先一定是配置TRUNK ,然后是VTP ,最后是VLAN
2.2 client
2.3 transparent
2.4 off
1. VTP OFF MODE 首先是CATOS 交换机时代的一个东西。
2. VTP off mode 类似透明MODE ,但是他不会像透明模式那样把接收到的VTP 通告消
息转发出去.
VTP 默认开启,VTP DOMAIN 参数默认为空,VTP 密码默认为空。 TRUNK MUST FIRST BE CONFIGURED
VTP CONFIGURATION REVISON (VTP 配置修订号) 其默认值是0
当你在设备上对VLAN 信息进行添加和删除时,配置修订号会增加1 该配置修订号,才是决定是否被同步的参数。
SW1(server)-------------------------SW2(CLIENT)---------------SW3(server) Domain :CCIE
SW1 VTP C R =10
SW2 VTP C R =0
Step 1:(由于SW2 接受到的来自于SW1 的VTP 通告消息所包含的 CR 大于本地,所以SW2 被SW1 同步)
SW3 VTP C R =11
Step 2: SW2 将VTP 通告消息发给SW3 ,且该通告消息的VTP C R 10,由于SW3 C R 大于所接受的通告消息所包含的配置修订号,所以SW3 反而不会被同步。
Step 3: SW3 发送VTP 通告消息,该消息的C R 11,这个值已经大于SW1 SW2。 你刻意修改VTP DOMAIN 参数,VTP DOMAIN 被修改了,那么VTP REVISION 自动变0
3:VTP 疑难部分
3.1 VTP 版本
VTP V1 V2 V3
#Vlan database
Vtp v2-mode
SW1(server)-----trunk-----SW2(client)--------trunk---------SW3(client)
题目需求,SW1 SW2 SW3 can support token ring vlans.
VTP V2-MODE 的配置信息,也可以被包含到VTP 通告消息内,然后同步给其他交换机。
VTP TRANSPARENT 有2个版本
V1 只透传相同DOMAIN 和相同VTP 参数的VTP 通告。( 默认的)
V2 可以透传不同DOMAIN 的VTP 通告消息
Switch(config)#Vtp version 2 该命令是用来修改VTP transparent 版本的。
SW1(server)-----trunk-----SW2(transparent)--------trunk---------SW3(client)
SW1 SW3 VTP DOMAIN :CCIE
SW2 VTP DOMAIN CCNP
3.2 VTP pruning
VTP PRUNNING
只要在SERVER 模式上敲就可以了,其他处于相同DOMAIN 的CLIENT 设备自动就开启了。
Vtp pruing是默认不启动的
Vlan database
Vtp pruning
其实vtp 的修剪就是将广播组播未知单播贞限制在到达目的的必经路径中。
4:VTP CONFIGURATION
1)config)#vtp mod ser/cl/trans
2)config)#vtp domain xx
3)config)#vtp password xxx(可选)
4)config)#vtp version 2 (可选) 这里是VTP 透明模式版本,也是只需要在SERVER 配置
5)vlan database
vtp v2-mode (可选) VTP V2 版本 只需要在SERVER 上进行配置CLIENT 会通过VTP 通告消息,学到该特性
6)config)#vtp pruning (可选)
7) config)# VTP TRAP (可选)
Show vtp status
Show vtp password
SW1#show vtp status
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 1005
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name :
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)
SW1#show vtp status
VTP Version : 2
Configuration Revision : 1
Maximum VLANs supported locally : 1005
Number of existing VLANs : 5
VTP Operating Mode : Server
VTP Domain Name : CCIE
VTP Pruning Mode : Enabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x6B 0xF4 0x42 0x70 0xC4 0x4E 0x18 0xE0 Configuration last modified by 0.0.0.0 at 3-1-93 01:45:49
Local updater ID is 0.0.0.0 (no valid interface found)
Show vtp password
SW1#show int trunk
Port Mode Encapsulation Status Native vlan
Fa0/1 on 802.1q trunking 3
Fa0/19 desirable n-isl trunking 1
Fa0/20 desirable n-isl trunking 1
Fa0/21 desirable n-isl trunking 1
Fa0/22 desirable n-isl trunking 1
Fa0/23 desirable n-isl trunking 1
Fa0/24 desirable n-isl trunking 1
Port Vlans allowed on trunk
Fa0/1 2-3
Fa0/19 1-4094
Fa0/20 1-4094
Fa0/21 1-4094
Fa0/22 1-4094
Fa0/23 1-4094
Fa0/24 1-4094
Port Vlans allowed and active in management domain
Fa0/1 2-3
Fa0/19 1-3
Fa0/20 1-3
Port Vlans allowed and active in management domain
Fa0/21 1-3
Fa0/22 1-3
Fa0/23 1-3
Fa0/24 1-3
Port Vlans in spanning tree forwarding state and not pruned Fa0/1 2-3
Fa0/19 1-3
Fa0/20 2-3
Fa0/21 1-3
Fa0/22 1-3
Fa0/23 1-3
Fa0/24 1-3
管理员在SHOW INT TRUNK 中看到的VTP PRUNING 信息是,不被修剪的VLAN 列表
EC (ethernet channel)基本概念
1:目的
EC 就是聚合链路,以此来提高交换机间的带宽。
EC 在做链路聚合时,只能最多将8条链路聚合成一个逻辑的链路。
2:根据实施技术分类
2.1 PAGP 端口聚合协议
AUTO 类似于LAC P 的PASSIVE 模式.
DESIRABLE 类似于LACP 的ACTIVE 模式
2.2 LACP 链路聚合协议(公开)
PASSIVE 类似于PAGP 的AUTO 模式.
ACTIVE 类似于PAgp 的DESIRABLE 模式
比如本地有8个端口,即将加入一个EC 通道,那么在加入前,8个端口都分别参与STP 的计算,但是加入后,由于产生了逻辑的EC 接口,所以在STP 中会有一个变化,之前参与生成树的8个独立的端口,不再参与了,而是由逻辑端口替代他们参与生成树。
2.3 manual 手动人工实施
ON
OFF
3:EC 的应用
3.1 2LAYERS EC
两个交换机间的链路聚合后去访问某一个特定VLAN 或者被配置为TRUNK 。
SW1 FA 0/23-24------------------FA0/23-24 SW2
Switchport mode dynamic desirable
直连多条TRUNK LINK 通过EC 捆绑成一条逻辑的TRUNK LINK
Switchport mode access(只有C2950 2960交换机端口默认模式是ACCESS, 而C3550 C 3560 C3750 C4500 C6500默认交换机端口模式都是dynamic)
直连多条模式为ACCESS 的LINK 捆绑后也是一个ACCESS LINK
4.2 3 LAYERS EC
两个交换机间的链路聚合后,会产生一个逻辑的EC 端口,我们将会给这个逻辑端口添加IP 。
No swtichport routed port
将本地和远端直连的多个2层端口变为3层端口,然后聚合为一个逻辑3层端口,参与路由
EC 的配置注意事项,详见 C3560 配置文档765P
5:EC 的负载均衡
SW1#show etherchannel load-balance
EtherChannel Load-Balancing Operational State (src-mac):
Non-IP: Source MAC address
IPv4: Source MAC address
IPv6: Source IP address
SW1(config)#port-channel load-balance dst-mac
SW1(config)#port-channel load-balance ?
dst-mac Dst Mac Addr
src-mac Src Mac Addr
src-ip
dst-ip
src-dst-ip
src-dst-mac
Configuration ec
1:PAGP &LACP 的配置
因为以太网通道组的配置而产生的逻辑的通道组接口,是必须由人工删除,否则是不会随着EC 的配置消失而自动消失。
1.1 注意事项
C3560 765PAGE
2:LAYERS 2 EC 的创建
Step 1:
Interface range fa xx-xx
Step 2:
Shutdown
Step3:
Switchport trunk encapsulation DOT1Q/ISL
Swtichport mode trunk
Switchport mode access
Switchport access vlan XX(这个VLAN 必须已经存在)
Step 4:
通道组中
Channel-protocol pagp/lacp
SW1#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: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) - Fa0/21(P) Fa0/22(P/D )
Group 代表EC 组
Port-channel 代表聚合而成的逻辑接口以及他的状态
Portocol 代表是否使用了PAGP 和LACP 的协议,进行动态的EC 协商,如果是- 代表是认为通过MODE ON 指定端口加入特定EC GROUP 成为聚合端口
Ports 代表EC GROUP 中的真实物理接口及其状态
3:LAYERS3 EC 的创建
Step 1:
Interface range fa xx-xx
Step 2:
Shutdown
Step3:
No switchport (将1个2层端口升级为3层端口)
Step 4:
Channel-group xx mode on
Channel-group protocol pagp/lacp
Channel-group XX mode desi/auto/pass/active
Step5:
No sh
Step 6:
Interface port-channel xx
No swtichport
Ip address x.x.x.x.x x.x.x.x.x
4:LAB
SW3--YY.YY.X.3--L3--YY.YY.X.2--SW1--------SW2
interface FastEthernet0/23
switchport mode dynamic desirable
end
这个端口模式:ACCESS TRUNK DESIRABLE(DTP 动态TRUNK 协商协议)
5:查看命令
SW1#show eth su
Flags: D - down P - in port-channel
I - stand-alone s - suspended
H - Hot-standby (LACP only)
R - Layer3 S - Layer2
u - unsuitable for bundling
U - in use f - failed to allocate aggregator
d - default port
Number of channel-groups in use: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
12 Po12(SU) - Fa0/23(P) Fa0/24(P)
SU 是整个EC 的状态
EC LAB
1:LAYER 2 EC
1.1
FA 0/21-22 ACCESS
SW1--(FA0/21-22)-----------(FA0/21-22)-SW2
interface FastEthernet0/21
switchport mode access
channel-group 1 mode on
end
SW1#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: 1
Number of aggregators: 1
Group Port-channel Protocol Ports
------+-------------+-----------+-----------------------------------------------
1 Po1(SU) - Fa0/21(P) Fa0/22(P)
D
1.2:
SW1--(FA0/21-22)-----------(FA0/21-22)-SW2
SW1/SW2 上创建VLAN 200
让SW1/SW2的FA0/21-22 加入VLAN 200,并且配置EC
interface FastEthernet0/21
switchport access vlan 200
switchport mode access
channel-group 1 mode on
end
VLAN 如果想处于UP UP 状态,那么VLAN 在交换机上必须包含激活状态的端口或着是有处于激活状态的TRUNK
1.3
SW1--(FA0/21-22)-----TRUNK------(FA0/21-22)-SW2
!
interface FastEthernet0/21
switchport trunk encapsulation dot1q
switchport mode trunk
channel-group 1 mode on
end
SW1#sh run int por
SW1#sh run int port-ch
SW1#sh run int port-channel 1
Building configuration...
Current configuration : 92 bytes
!
interface Port-channel1
switchport trunk encapsulation dot1q
switchport mode trunk
end
2:LAYER 3 EC
SW1--(FA0/21-22)-----------(FA0/21-22)-SW2
要求SW1 SW2 之间的端口变成可路由端口
然后给PORTCHANNEL 添加一个IP ,分别是78.78.78.X/24
interface FastEthernet0/21
no switchport
no ip address
channel-group 7 mode on
end
SW1#sh run int port-channel 7
Building configuration...
Current configuration : 83 bytes
!
interface Port-channel7
no switchport
ip address 78.78.78.7 255.255.255.0
end
SW1#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(SD) -
7 Po7(RU) - Fa0/21(P) Fa0/22(P)
SW1(config)#port-channel load-balance dst-mac
SW1#show etherchannel load-balance
EtherChannel Load-Balancing Operational State (dst-mac):
Non-IP: Destination MAC address
IPv4: Destination MAC address
IPv6: Destination IP address
SW1#
STP
1:STP 的作用
1)防环
2)提供LINK 冗余的
2:STP 的版本
802.1D STP
802.1S RSTP
802.1W MSTP (MSTP 的树状结构是RSTP 维护的,而MSTP 只是可以运用最少的生成树实例就可以维护一个巨型的交换 网络)
3:STP 大纲
3.1 STP 如何防止环路
3.2 STP 如何竞选ROOT BRIDGE 以及ROOT PORT D P
3.3 STP 如何维护以及重算生成树实例
3.4 STP 的缺陷
3.5 STP 的增强特性(都是由CISCO 开发设计的)
4:冗余拓扑
4.1 冗余拓扑主要是为了避免交换机间的单故障点的出现。
4.2 冗余拓扑的问题
4.2.1 交换机如何处理数据帧
1)对于未知单播帧,广播帧,组播帧,交换机采用的转发机制是泛洪,也就是除接收端口以外的所有端口发送该 帧。
4.2.2 交换机如何构建MAC 地址列表
当交换机特定端口接收到一个进站数据帧时,交换机会把该进站数据帧的SOURCE MAC 地址和接收该帧的接口做成 对应关系,且放入CAM 表中。
4.2.3 冗余拓扑和SW 机制造成的3个问题
构成:广播风暴,错误的CAM ,重复的数据帧接受和发送
5:STP 防环机制
利用STP 算法,在一个环形拓扑中,计算出一个无环的树状结构,那么我们一般称这个树状结构为 STP 的一个实例。
STP 算法中,必须先选出一个ROOT BRIDGE 交换,交换网络中ROOT BRIDGE 只有一个(前提是VLAN 只有1个)
STP 算法中,每个非根网桥会找出一个端口,而这个端口到根的开销是最低的,所以只有这个端口是 NON ROOT BRIDGE 和ROOT BRIDGE 的链接。
5.1 STP 的算法
5.1.1 ROOT BRIDGE 竞选
BPDU 就是用于进行ROOR BRIDGE 竞选的
2S 发送一次,35字节
Root bridge ID 就是承载着ROOT BRIDGE 的BID
BID 就是当前交换机的标识
(stp switch priority 32768 不一定总是32768
mac xx-xx-xx-xx-xx-xx)
BID 字段包含的参数越小,则越优 (根交换机上所有端口都叫做指定端口,他们全部处于转发状态,并且可以学 习MAC 地址)
5.1.2 非根交换机的根端口及网段间指定端口选举
最低的到达根网桥的路径开销
带宽(M ) STP COST
10 100
100 19
1000 4
10G 2
最低的发送方BID ,最小的SENDER BID
比较最优的发送方PID
Priority 128
Port number xx
越小越优
关于生成树的端口状态
Blocking 可以接受BPDU ,但是不能发送BPDU ,并且不能转发用户数据和学习MAC 地址
20s
Listening 可以发送BPDU , 并且把接受到的BPDU 进行一个比较,选择出ROOT BIRDGE ROOT PORT DP
15S
Learning 学习MAC 地址,也不能转发用户数据
15S
Forwarding 可以转发用户的数据并且也可以学习MAC 地址
连接着PC 机的端口是不需要参与STP 的,但是默认任何交换机的接口一但处于激活状态都会参与STP 的计算
5.1.3 每个网段的指定端口
1)看开销
2)BID
3)PID
5.2 STP 维护
STP 有一个HOLD TIME 20S
5.3 STP 的端口状态
见文档
6:STP 的基本命令
Show spanning-tree bridge 查看当前交换机的BID
SW1#show spanning-tree bridge
Hello Max Fwd
Vlan Bridge ID Time Age Dly
Protocol
---------------- --------------------------------- ----- --- --- -------- VLAN0001 32769 (32768, 1) 0015.2bb6.6b00 2 20 15 ieee 拓展的系统ID 优先级加VLAN 编号。
Show spanning root 查看根交换机信息
SW3#
SW3#show span root
Root Hello Max Fwd
Vlan Root ID Cost Time Age Dly Root Port ---------------- -------------------- --------- ----- --- --- ------------ VLAN0001 32769 0009.4376.2300 0 2 20 15
SW3#show spanning-tree detail
VLAN0001 is executing the ieee compatible Spanning Tree protocol
Bridge Identifier has priority 32768, sysid 1, address 0009.4376.2300 Configured hello time 2, max age 20, forward delay 15
We are the root of the spanning tree
PVST
1:PVST 概念
PVST 每VLAN spanning tree
1)TRUNK 本身是用于承载不同VLAN 流量,所以他不属于任何VLAN
2)交换机间的TRUNK LINK 是可能造成环路。
2:PVST 的版本
2.1 利用STP 算法为VLAN 计算拓扑,PVST
3:拓展的SYSTEM ID
拓展系统ID 通过使用固定的MAC 地址加上拓展的优先级组成了不重复BID ,从而提供给每个VLAN 使用。
BID
32768
MAC
每个VLAN 都希望有一个不重复的BID
SW1#show spanning-tree bridge
Hello Max Fwd
Vlan Bridge ID Time Age Dly Protocol ---------------- --------------------------------- ----- --- --- -------- VLAN0001 32769 (32768, 1) 0015.2bb6.6b00 2 20 15 ieee