2010_8_14_交換_樓宇網絡VLAN間路由

拓撲圖

原題:

clip_image002

增加一條冗餘線路的STP部分新題:

clip_image004

實驗環境和要求

爲了安全和排錯網絡故障較爲容易,按部門將網絡成了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

clip_image006

配置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的配置,查看生成樹結果:

clip_image008

….

clip_image010

果然SW1的G7/1被Block了。

以上完成了配置。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章