文档介绍:【实验名称】
通过路由器实现VLAN间路由
【实验目的】
掌握如何通过路由器实现VLAN间路由。
【背景描述】
作为企业的网络管理员,你按企业的部门结构创建了多个VLAN,为了实现数据资源的共享,现在需要使不同的VLAN里的用户相互通信,于是你决定配置路由器来实现VLAN间路由。
本实验以1台S2126G交换机和1台R2620路由器为例,,,PC1和PC2分别属于Vlan10和Vlan 20,缺省网关分别指定为Vlan10和Vlan 。
【实现功能】
使位于不同VLAN里的用户可以相互通信。
【实验拓扑】
【实验设备】
S2126G(1台)、R2620(1台)
【实验步骤】
第一步:在交换机S2126G上创建Vlan 并分配相应端口
S2126G (config)# vlan 10 !创建Vlan 10
S2126G (config)# vlan 20 !创建Vlan 20
S2126G(config)#interface 0/1 !进入接口配置模式
S2126G(config-if)#switchport access vlan 10 !将F0/1端口分配给Vlan 10
S2126G(config)#interface 0/2 !进入接口配置模式
S2126G(config-if)#switchport access vlan 20 !将F0/2端口分配给Vlan 20
S2126G(config)#interface 0/23
S2126G(config-if)#switchport mode trunk ! 配置trunk端口
验证测试:验证VLAN和Trunk配置
S2126G #show vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/3 ,Fa0/4 ,Fa0/5
Fa0/6 ,Fa0/7 ,Fa0/8
Fa0/9 ,Fa0/10,Fa0/11
Fa0/12,Fa0/13,Fa0/14
Fa0/15,Fa0/16,Fa0/17
Fa0/18,Fa0/19,Fa0/20
Fa0/21,Fa0/22,Fa0/23
Fa0/24
10 VLAN0010 active Fa0/1 ,Fa0/23
20 VLAN0020 active Fa0/2 ,Fa0/23
S2126G #show interface 0/23 switchport ! 验证端口的完整配置
Interface Switchport Mode Access Native Protected VLAN lists
---------- ---------- --------- ------- -------- --------- --------------------
Fa0/2