您的位置:首页 > 职场人生

多层交换VLAN间路由

2010-11-01 16:56 309 查看
实验二十六、多层交换机VLAN 的划分和 VLAN间路由

一、 实验目的

1、了解 VLAN 原理;

2、学会使用各种多层交换设备进行 VLAN 的划分;

3、理解 VLAN 之间路由的原理和实现方法;

二、 应用环境

软件实验室的IP 地址段是192.168.10.0/24,多媒体实验室的IP 地址段是192.168.20.0/24,为了保证它们之间的数据互不干扰,也不影响各自的通信效率,我们划分了VLAN,使两个实验室属于不同的VLAN 。两个实验室有时候也需要相互通信,此时就要利用三层交换机划分VLAN 。

三、 实验设备

1、DCRS-7604(或 6804 或 5526S)交换机1 台

2、PC机 2 台

3、Console 线1根

4、直通网线若干

四、 实验拓扑





使用一台交换机和两台PC 机,还将其中PC2 作为控制台终端,使用Console 口配置方式;使用两根网线分别将PC1 和PC2 连接到交换机的RJ-45 接口上。

五、 实验要求

在交换机上划分两个基于端口的VLAN:VLAN100,VLAN200 。

VLAN 端口成员

100 1/1~1/12

200 1/13~1/24 使得 VLAN100 的成员能够互相访问,VLAN200 的成员能够互相访问;VLAN100 和

VLAN200 成员之间不能互相访问。

PC1 和PC2 的网络设置为:

设备 端口 IP 1 网关 1 IP 2 网关 2 Mask

交换机A 192.168.1.1 无 192.168.1.1 无 255.255.255.0

Vlan100 无 无 192.168.10.1 无 255.255.255.0

Vlan200 无 无 192.160.20.1 无 255.255.255.0

PC1 1~12 192.168.1.101 无 192.168.10.101 192.168.10.1 255.255.255.0

PC2 13~24 192.168.1.102 无 192.168.20.101 192.168.20.1 255.255.255.0

各设备的IP 地址首先按照IP1 配置,使用pc1 ping pc2,应该不通;

再按照IP2 配置地址,并在交换机上配置vlan 接口IP 地址,使用pc1 ping pc2,则通, 该通信属于vlan 间通信,要经过三层设备的路由。若实验结果和理论相符,则本实验完成。

六、 实验步骤

第一步:交换机恢复出厂设置

switch#set default

switch#write

switch#reload

第二步:给交换机设置IP 地址即管理IP。

switch#config

switch(Config)#interface vlan 1

switch(Config-If-Vlan1)#ip address 192.168.1.1 255.255.255.0

switch(Config-If-Vlan1)#no shutdown

switch(Config-If-Vlan1)#exit

switch(Config)#exit

第三步:创建 vlan100 和 vlan200。

switch(Config)#

switch(Config)#vlan 100

switch(Config-Vlan100)#exit

switch(Config)#vlan 200

switch(Config-Vlan200)#exit

switch(Config)#

验证配置:

switch#show vlan

VLAN Name Type Media Ports

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

1 default Static ENET Ethernet1/1 Ethernet1/2

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

200 VLAN0200 Static ENET

第四步:给vlan100 和vlan200 添加端口。

switch(Config)#vlan 100 !进入 vlan 100

switch(Config-Vlan100)#switchport interface ethernet 1/1-12

Set the port Ethernet1/1 access vlan 100 successfully

Set the port Ethernet1/2 access vlan 100 successfully

Set the port Ethernet1/3 access vlan 100 successfully

Set the port Ethernet1/4 access vlan 100 successfully

Set the port Ethernet1/5 access vlan 100 successfully

Set the port Ethernet1/6 access vlan 100 successfully

Set the port Ethernet1/7 access vlan 100 successfully

Set the port Ethernet1/8 access vlan 100 successfully

Set the port Ethernet1/9 access vlan 100 successfully

Set the port Ethernet1/10 access vlan 100 successfully

Set the port Ethernet1/11 access vlan 100 successfully

Set the port Ethernet1/12 access vlan 100 successfully

switch(Config-Vlan100)#exit

switch(Config)#vlan 200 !进入vlan 200

switch(Config-Vlan200)#switchport interface ethernet 1/13-24

Set the port Ethernet1/13 access vlan 200 successfully

Set the port Ethernet1/14 access vlan 200 successfully

Set the port Ethernet1/15 access vlan 200 successfully

Set the port Ethernet1/16 access vlan 200 successfully

Set the port Ethernet1/17 access vlan 200 successfully

Set the port Ethernet1/18 access vlan 200 successfully

Set the port Ethernet1/19 access vlan 200 successfully

Set the port Ethernet1/20 access vlan 200 successfully

Set the port Ethernet1/21 access vlan 200 successfully

Set the port Ethernet1/22 access vlan 200 successfully

Set the port Ethernet1/23 access vlan 200 successfully

Set the port Ethernet1/24 access vlan 200 successfully

switch(Config-Vlan200)#exit

验证配置:

switch#show vlan

VLAN Name Type Media Ports

---- ------------ ---------- --------- ---------------------------------------- 1 default Static ENET Ethernet1/25 Ethernet1/26

Ethernet1/27 Ethernet1/28

100 VLAN0100 Static ENET Ethernet1/1 Ethernet1/2

Ethernet1/3 Ethernet1/4

Ethernet1/5 Ethernet1/6

Ethernet1/7 Ethernet1/8

Ethernet1/9 Ethernet1/10

Ethernet1/11 Ethernet1/12

200 VLAN0200 Static ENET Ethernet1/13 Ethernet1/14

Ethernet1/15 Ethernet1/16

Ethernet1/17 Ethernet1/18

Ethernet1/19 Ethernet1/20

Ethernet1/21 Ethernet1/22

Ethernet1/23 Ethernet1/24

switch#

第五步:验证实验。

配置 IP1 的地址

PC1 位置 PC2 位置 动作 结果

1/1-1/12 端口 1/13-1/24 端口 PC1 ping PC2 不通

第六步:添加 vlan 地址。

switch(Config)#interface vlan 100

switch(Config-If-Vlan100)#%Feb 13 15:47:45 2006 %LINK-5-CHANGED: Interface

Vlan100, changed state to UP%Feb 13 15:47:45 2006 %LINEPROTO-5-UPDOWN: Line protocol

on Interface Vlan100, changed state to UP

switch(Config-If-Vlan100)#

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

switch(Config-If-Vlan100)#no shut

switch(Config-If-Vlan100)#exit

switch(Config)#interface vlan 200

switch(Config-If-Vlan200)#%Feb 13 15:48:06 2006 %LINK-5-CHANGED: Interface

Vlan200, changed state to UPswitch(Config-If-Vlan200)#ip address 192.168.20.1

255.255.255.0

switch(Config-If-Vlan200)#no shut

switch(Config-If-Vlan200)#exit

switch(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#

第七步:验证实验。

配置 IP2 的地址

PC1 位置 PC2 位置 动作 结果

1/1-1/12 端口 1/13-1/24 端口 PC1 ping PC2 通
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息