多層交換機實現二層交換機 VLAN 之間的路由

實驗二十7、使用多層交換機實現二層交換機 VLAN 之間的路由網絡

1、 實驗目的ide

一、理解多層交換機的路由原理this

二、 瞭解多層交換機在實際網絡中的經常使用配置blog

三、 回顧二層交換機 VLAN 的劃分方法ip

四、進一步理解 802.1Q 的原理和使用方法路由

2、 應用環境get

二層交換機屬於接入層交換機,在二層交換機上根據鏈接用戶的不一樣,劃分了不一樣it

VLAN,有時候會出現同一個 VLAN 處於不一樣的交換機上。這些二層交換機被一臺三層交換機所匯聚。所以咱們須要實現多交換機的跨交換機VLAN 通訊,也須要實現VLAN 間的通訊。所以出現本實驗所要演示的功能。io

3、 實驗設備class

一、DCRS-7604(或 6804 或 5526S)交換機1 臺

二、DCS-3926S 交換機 1-2 臺

三、PC機 2-4 臺

四、Console 線1-3 根

五、直通網線若干

4、 實驗拓撲

clip_p_w_picpath002

5、 實驗要求

在交換機A 和交換機B 上分別劃分兩個基於端口的VLAN:VLAN100,VLAN200 。 VLAN 端口成員

100 1~8

200 9~16

Trunk 口 24

在交換機C 上也劃分兩個基於端口的VLAN:VLAN100,VLAN200 。把端口1 和端口

2 都設置成Trunk 口。

VLAN IP Mask

100 192.168.10.1 255.255.255.0

200 192.168.20.1 255.255.255.0

Trunk 口 1/1 和 1/2

交換機A 的24 口鏈接交換機C 的1 口,交換機B 的24 口鏈接交換機C 的2 口。

PC1-PC4 的網絡設置爲:

設備 IP 地址 gateway Mask

PC1 192.168.10.11 192.168.10.1 255.255.255.0

PC2 192.168.20.22 192.168.20.1 255.255.255.0

PC3 192.168.10.33 192.168.10.1 255.255.255.0

PC4 192.168.20.44 192.168.20.1 255.255.255.0

驗證:

一、不給PC 設置網關:

PC一、PC3 分別接在不一樣交換機VLAN100 的成員端口 1~8 上,兩臺 PC 互相能夠ping

通;PC二、PC4 分別接在不一樣交換機VLAN 的成員端口9~16 上,兩臺PC 互相能夠ping 通;

PC一、PC3 和PC二、PC4 接在不一樣VLAN 的成員端口上則互相ping 不通。

二、給PC 設置網關:

PC一、PC3 和PC二、PC4 接在不一樣VLAN 的成員端口上也能夠互相ping 通。

若實驗結果和理論相符,則本實驗完成。

6、 實驗步驟

第一步:交換機恢復出廠設置

switch#set default

switch#write

switch#reload

第二步:給交換機設置標示符和管理 IP。

交換機 A:

switch(Config)#hostname switchA

switchA(Config)#interface vlan 1

switchA(Config-If-Vlan1)#ip address 192.168.1.11 255.255.255.0

switchA(Config-If-Vlan1)#no shutdown

switchA(Config-If-Vlan1)#exit

switchA(Config)#

交換機 B:

switch(Config)#hostname switchB

switchB(Config)#interface vlan 1

switchB(Config-If-Vlan1)#ip address 192.168.1.12 255.255.255.0 switchB(Config-If-Vlan1)#no shutdown

switchB(Config-If-Vlan1)#exit

switchB(Config)#

交換機 C:

DCRS-7604#config

DCRS-7604(Config)#

DCRS-7604(Config)#hostname switchC

switchC(Config)#interface vlan 1

switchC(Config-If-Vlan1)#ip address 192.168.1.13 255.255.255.0

switchC(Config-If-Vlan1)#no shutdown

switchC(Config-If-Vlan1)#exit

switchC(Config)#exit

switchC#

第三步:在交換機中建立 vlan100 和 vlan200,並添加端口。

交換機 A:

switchA(Config)#vlan 100

switchA(Config-Vlan100)#

switchA(Config-Vlan100)#switchport interface ethernet 0/0/1-8

switchA(Config-Vlan100)#exit

switchA(Config)#vlan 200

switchA(Config-Vlan200)#switchport interface ethernet 0/0/9-16

switchA(Config-Vlan200)#exit

switchA(Config)#

驗證配置:

switchA#show vlan

VLAN Name Type Media Ports

------------------------- --------- ----------------------------------------

1 default Static ENET Ethernet0/0/17 Ethernet0/0/18

Ethernet0/0/19 Ethernet0/0/20

Ethernet0/0/21 Ethernet0/0/22

Ethernet0/0/23 Ethernet0/0/24

100 VLAN0100 Static ENET Ethernet0/0/1 Ethernet0/0/2

Ethernet0/0/3 Ethernet0/0/4

Ethernet0/0/5 Ethernet0/0/6

Ethernet0/0/7 Ethernet0/0/8

200 VLAN0200 Static ENET Ethernet0/0/9 Ethernet0/0/10

Ethernet0/0/11 Ethernet0/0/12

Ethernet0/0/13 Ethernet0/0/14

Ethernet0/0/15 Ethernet0/0/16

switchA#

交換機 B: 配置與交換機 A 同樣。

第四步:設置交換機 trunk 端口

交換機 A:

switchA(Config)#interface ethernet 0/0/24

switchA(Config-Ethernet0/0/24)#switchport mode trunk

Set the port Ethernet0/0/24 mode TRUNK successfully

switchA(Config-Ethernet0/0/24)#switchport trunk allowed vlan all

set the port Ethernet0/0/24 allowed vlan successfully

switchA(Config-Ethernet0/0/24)#exit

switchA(Config)#

驗證配置:

switchA#show vlan

VLAN Name Type Media Ports

---- ------------ ---------- ---------

----------------------------------------

1 default Static ENET Ethernet0/0/17 Ethernet0/0/18

Ethernet0/0/19 Ethernet0/0/20

Ethernet0/0/21 Ethernet0/0/22

Ethernet0/0/23

Ethernet0/0/24(T)

100 VLAN0100 Static ENET Ethernet0/0/1 Ethernet0/0/2

Ethernet0/0/3 Ethernet0/0/4

Ethernet0/0/5 Ethernet0/0/6

Ethernet0/0/7 Ethernet0/0/8

Ethernet0/0/24(T)

200 VLAN0200 Static ENET Ethernet0/0/9 Ethernet0/0/10

Ethernet0/0/11 Ethernet0/0/12

Ethernet0/0/13 Ethernet0/0/14

Ethernet0/0/15 Ethernet0/0/16

Ethernet0/0/24(T)

switchA#

24口已經出如今vlan一、vlan100和vlan200中,而且24口不是一個普通端口,是tagged

端口。

交換機 B:

配置同交換機 A

交換機 C:

switchC(Config)#vlan 100

switchC(Config-Vlan100)#exit

switchC(Config)#vlan 200

switchC(Config-Vlan200)#exit

switchC(Config)#interface ethernet 1/1-2 switchC(Config-Port-Range)#switchport mode trunk

Set the port Ethernet1/1 mode TRUNK successfully

Set the port Ethernet1/2 mode TRUNK successfully

switchC(Config-Port-Range)#switchport trunk allowed vlan all

set the port Ethernet1/1 allowed vlan successfully

set the port Ethernet1/2 allowed vlan successfully

switchC(Config-Port-Range)#exit

switchC(Config)#exit

驗證配置:

switchC#show vlan

VLAN Name Type Media Ports

---------------- ---------- --------- ----------------------------------------

1 default Static ENET Ethernet1/1(T) Ethernet1/2(T)

Ethernet1/3 Ethernet1/4

Ethernet1/5 Ethernet1/6

Ethernet1/7 Ethernet1/8

Ethernet1/9 Ethernet1/10

Ethernet1/11 Ethernet1/12

Ethernet1/13 Ethernet1/14

Ethernet1/15 Ethernet1/16

Ethernet1/17 Ethernet1/18

Ethernet1/19 Ethernet1/20

Ethernet1/21 Ethernet1/22

Ethernet1/23 Ethernet1/24

Ethernet1/25 Ethernet1/26

Ethernet1/27 Ethernet1/28

100 VLAN0100 Static ENET Ethernet1/1(T) Ethernet1/2(T)

200 VLAN0200 Static ENET Ethernet1/1(T) Ethernet1/2(T)

switchC#

第五步:交換機 C 添加 vlan 地址。

switchC(Config)#interface vlan 100

switchC(Config-If-Vlan100)#ip address 192.168.10.1 255.255.255.0

switchC(Config-If-Vlan100)#no shut

switchC(Config-If-Vlan100)#exit

switchC(Config)#interface vlan 200

switchC(Config-If-Vlan200)#no shutdown

switchC(Config-If-Vlan200)#exit

switchC(Config)#

驗證配置:

switch#show ip route

Total route items is 3, the matched route items is 3

Codes: C - connected, S - static, R - RIP derived, O - OSPF derived

A - OSPF ASE, B - BGP derived, D - DVMRP derived Destination Mask Nexthop Interface Preference

C 192.168.1.0 255.255.255.0 0.0.0.0 Vlan1 0

C 192.168.10.0 255.255.255.0 0.0.0.0 Vlan100 0

C 192.168.20.0 255.255.255.0 0.0.0.0 Vlan200 0

switch#

第七步:驗證明驗。

一、PC 不配置網關,互相 ping,查看結果;

二、PC 配置網關,互相 ping,查看結果;

相關文章
相關標籤/搜索