一.链路聚合技术
端口绑定(链路聚合)技术:
链路聚合是将一组物理接口捆绑在一起作为一个逻辑接口来增加带宽的一种方法。通过在两台设备之间建立链路聚合组,可以提供更高的通讯带宽和更高的可靠性。
链路聚合不仅为设备间通信提供了冗余保护,而且不需要对硬件进行升级。
实现的条件:
有关链路聚合的命令
1.
lacp priority 1000
int Eth-trunk 1
bpdu enable
mode lacp-static
2.
int e0/0/10
eth-trunk 1
3.
int eth-trunk 1
max active-linknumber 2
二.生成树技术
1.什么是生成树
该协议可应用于环路网络,通过一定的算法实现路径冗余,同时将环路网络修剪成无环路的树bai型网络,从而避免报文在环路网络中的增生和无限循环。
STP的基本原理是,通过在交换机之间传递一种特殊的协议报文(在IEEE 802.1D中这种协议报文被称为“配置消息”)来确定网络的拓扑结构。配置消息中包含了足够的信息来保证交换机完成生成树计算。
2.为什么要用生成树?它的作用是什么?
因为当有环路存在时,广播的发送会引起全网的广播风暴,因此需要打破环路发生的条件,而生成树协议就是解决二层广播风暴的主要手段,另外我们会阻塞一些端口打破环路生成条件,当链路出现问题时,这些被阻塞的端口可以过渡到转发状态,实现链路的备份的作用。
3.BPDU
BDPU:网桥+协议数据单元
STP的各种选举是通过BPDU报文来实现的,BPDU是直接封装在以太网帧中的。(802.3+802.2)
对于参与所有STP的所有SW,它们都通过数据消息的交换来获取网络中其他SW的信息,这种消息被称为BPDU。
BPDU直接封装在二层的协议
4.BPDU的功能
BPDU每2s由根桥发送一次。(bride-id最小的成为根桥)
最初,每个SW都认为自己是根桥,都会发送BPDU比较Lowest BID,选举出一个根桥。此时只有根桥发送BPDU,非根只转发,转发时只修改bride-id和cost字段。
BPDU类型:
1.配置BPDU-------通常由根网桥以周期性间隔发出,包括STP参数,用于各种选举
2.TCN(topology change notification拓扑变更通告)BPDU这种BPDU是当交换机检测到拓扑变更时所发生
选举根交换机的规则:
lowest BID=网桥优先权=MAC地址(越小越优)
sw默认优先级是32768
设置根网桥方法:
1.修改网桥优先级命令
【sw1】stp priority 0(需设定为4096的倍数)
2.设置此网桥为根网桥
【sw1】stp root primary(优先级变为0)
查看根网桥命令:
display stp
三.端口
(一)端口角色
RP:根端口
每个非根上有且只有一个,选举路径开销最小的为根端口
DP:指定端口
根网桥上每个端口都是指定端口
AP:预备端口
该接口状态为blocking状态,只收BPDU,不发BPDU
(二)端口状态描述
Blocking/discarding(阻塞状态):不转发数据帧,不学习MAC。接收并处理BPDU,不发送BPDU。
Listening(侦听状态):不转发,不学习。参与生成树计算,接收并发送BPDU
Learning(学习状态):不转发,学习MAC地址表,参与生成树计算,接收并发送BPDU
Forwarding(转发状态):转发 学习 参与计算。接收并发送BPDU
(三)选举根、指定端口的规则:
1.Lowest path cost to root bridge.(到根的最小路径开销)
2.Lowest sender BID(最小发送方BID)
3.Lowest sender port ID(最小发送方PID)
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname SW1
[SW1]undo info-center enable
Info: Information center is disabled.
[SW1]user-interface console 0
[SW1-ui-console0]idle-timeout 0 0
[SW1-ui-console0]q
[SW1]vlan bat 10 20
Info: This operation may take a few seconds. Please wait for a moment...done.
[SW1]int e0/0/1
[SW1-Ethernet0/0/1]port link-type access
[SW1-Ethernet0/0/1]port default vlan 10
[SW1-Ethernet0/0/1]int e0/0/2
[SW1-Ethernet0/0/2]port link-type access
[SW1-Ethernet0/0/2]port default vlan 20
[SW1-Ethernet0/0/2]int e0/0/3
[SW1-Ethernet0/0/3]port link-type trunk
[SW1-Ethernet0/0/3]port trunk allow-pass vlan all
[SW1-Ethernet0/0/3]int e0/0/4
[SW1-Ethernet0/0/4]port link-type trunk
[SW1-Ethernet0/0/4]port trunk allow-pass vlan all
[SW1-Ethernet0/0/4]q
[SW1]stp mode mstp
[SW1]stp region-configuration
[SW1-mst-region]region-name huawei
[SW1-mst-region]revision-level 1
[SW1-mst-region]instance 1 valn 10
[SW1-mst-region]instance 2 vlan 20
[SW1-mst-region]active region-configuration
Info: This operation may take a few seconds. Please wait for a moment...done.
The device is running!
<Huawei>sys
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname R1
[R1]undo info-center enable
Info: Information center is disabled.
[R1]user-interface console 0
[R1-ui-console0]idle-timeout 0 0
[R1-ui-console0]q
[R1]int g0/0/0
[R1-GigabitEthernet0/0/0]undo sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]ip add 192.168.10.254 24
[R1-GigabitEthernet0/0/0]un sh
Info: Interface GigabitEthernet0/0/0 is not shutdown.
[R1-GigabitEthernet0/0/0]int g0/0/1
[R1-GigabitEthernet0/0/1]ip add 192.168.20.254 24
[R1-GigabitEthernet0/0/1]un sh
Info: Interface GigabitEthernet0/0/1 is not shutdown.
[R1-GigabitEthernet0/0/1]int loop 0
[R1-LoopBack0]ip add 1.1.1.1 32
[R1-LoopBack0]q
[R1]