您的位置:首页 > 理论基础 > 计算机网络

2010_8_14_交换_楼宇网络VLAN间路由

2010-08-14 18:15 477 查看
拓扑图 原题:



增加一条冗余线路的STP部分新题:



实验环境和要求 为了安全和排错网络故障较为容易,按部门将网络成了4个VLAN。期中VLAN4是服务器VLAN,专门存放单位的服务,服务器的网卡是1000M以太网。
计算机的IP地址已经按照图示设置完成。网关是该网段第一个能用的地址。
需要在三个接入层交换机创建3个VLAN,并将接口按照图示指定到VLAN。
在汇集层交换机和接入层交换机之间配置干道链路。
配置SW0为STP根桥,并且修改Priority使SW1的端口成为Block的。
在汇集层交换机实现VLAN间路由。
实验中的基本原理 STP端口角色选择定律 1.根交换机的选举(Root Bridge
交换机之间通过发送BPDU来选举根交换机
Root Bridge是最小BID(优先级(bridge priority)+MAC地址)的交换机将成为根交换机。
例如:MulSW0(config)#spanning-tree vlan 1 priority 4096
(全局模式下,vlan1的优先级修改命令)

2.根端口的选举(Root Port
每个非根交换机有且仅有一个根端口。非根交换机上的根端口从非根交换机到根交换机的最低路径花费的端口是根端口。具体分析如下:
1. Cost比较,选到Root Bridge 的Cost小(例如路径带宽越大,cost越小)的。
2. 比较交换机的bridge priority,最小的是Root(bridge priority是全局的,不是针对某个接口的)
例如:MulSW0(config)#spanning-tree vlan 1 priority 4096
(全局模式下,vlan1的优先级修改命令)
3. 最后比较发送端口的PID(port-priority端口优先级,是针对某个端口的,不是全局的)。PID小的端口成为根端口。
例如:MulSW0(config-if)#spanning-tree vlan 1 port-priority 16
(端口模式下,vlan1的端口优先级修改命令)

3.选举指派端口Designed port
每个网段都有一个指派交换机,该交换机负责把网段的数据发送给根桥。指派交换机上的端口就是指派端口。
第一步:比较路径花费(COST)。
第二步:比较BID(注意是该网段上的往回走的隶属于的交换机的BID)(交换机的bridge priority)
第三步:比较PID(端口号越小的PID越小,F0/0<F0/1)。(port-priority端口优先级)
实验配置详解 1.Multilayer SW0 配置STP相关内容:修改bridge priority让SW0作为根桥:
Switch(config)#spanning-tree vlan 1 priority 8192
Switch(config)#spanning-tree vlan 2 priority 8192
Switch(config)#spanning-tree vlan 3 priority 8192
Switch(config)#spanning-tree vlan 4 priority 8192
注意,每个vlan都有各自的一个生成树,因此每个vlan都要设置一次优先级
配置vlan相关内容:创建vlan1-4并且配置ip地址:
MulSW0(config)#vlan 1
MulSW0(config)#vlan 2
MulSW0(config)#vlan 3
MulSW0(config)#vlan 4
只需要把F0/1和F0/2划分入VLan4,其它都是接入层的端口。
MulSW0(config)#interface fastEthernet 0/1
MulSW0(config-if)#switchport access vlan 1
MulSW0(config)#interface fastEthernet 0/2
MulSW0(config-if)#switchport access vlan 2
interface Vlan1
ip address 172.16.0.1 255.255.255.0
!
interface Vlan2
ip address 172.17.0.1 255.255.255.0
!
interface Vlan3
ip address 172.18.0.1 255.255.255.0
!
interface Vlan4
ip address 172.19.0.1 255.255.255.0
!
配置VTP相关内容:让SW0作为VTP的Servers,可以向接入层交换机传递Vlan信息:
MulSW0(config)#Vtp domain cisco
MulSW0(config)#vtp mode server
配置Trunk相关内容:
interface GigabitEthernet0/1
switchport trunk encapsulation dot1q
switchport mode trunk
!
interface GigabitEthernet0/2
switchport trunk encapsulation dot1q
switchport mode trunk
!
2.接入层SW2


配置VTP相关内容:让SW2作为VTP的Client,可以接收Vlan信息:
SW2(config)#vtp mode client
SW2(config)#vtp domain cisco
配置vlan相关内容:把接口划分到相应的Vlan中:
interface FastEthernet0/1
!
interface FastEthernet1/1
switchport access vlan 2
!
interface FastEthernet2/1
switchport access vlan 3
!
Vlan1不用划分,因为是默认端口都归入vlan1。
配置Trunk相关内容:
SW2(config)#interface gigabitEthernet 6/1
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk allowed vlan all
SW2(config)#interface gigabitEthernet 7/1
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk allowed vlan all
配置STP相关内容:修改SW2的port-priority更低使对方交换机SW1的gigabitEthernet 7/1端口成为Block的:
SW2(config)#interface gigabitEthernet 7/1
SW2(config-if)#spanning-tree vlan 1 port-priority 16
SW2(config-if)#spanning-tree vlan 2 port-priority 16
SW2(config-if)#spanning-tree vlan 3 port-priority 16
SW2(config-if)#spanning-tree vlan 4 port-priority 16
进入端口,注意必须每个vlan的端口优先级都设置,因为有三个生成树,查看生成树的结果:
SW2#show spanning-tree
VLAN0001
Spanning tree enabled protocol ieee
Root ID Priority 4097
Address 00E0.F7D4.C635
Cost 4
Port 7(GigabitEthernet6/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 8193 (priority 8192 sys-id-ext 1)
Address 0060.70DA.DDC6
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Fa0/1 Desg FWD 19 128.1 P2p
Gi6/1 Root FWD 4 128.7 P2p
Gi7/1 Desg FWD 4 16.8 P2p
VLAN0002
Spanning tree enabled protocol ieee
Root ID Priority 4098
Address 00E0.F7D4.C635
Cost 4
Port 7(GigabitEthernet6/1)
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Bridge ID Priority 8194 (priority 8192 sys-id-ext 2)
Address 0060.70DA.DDC6
Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec
Aging Time 20
Interface Role Sts Cost Prio.Nbr Type
---------------- ---- --- --------- -------- --------------------------------
Gi6/1 Root FWD 4 128.7 P2p
Gi7/1 Desg FWD 4 16.8 P2p
Fa1/1 Desg FWD 19 128.2 P2p
。。。。
一直到vlan4
3.接入层SW1 同理SW2的配置,查看生成树结果:



….



果然SW1的G7/1被Block了。
以上完成了配置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: