思科模拟器-实验16:三层交换 VLAN 互访配置

【实验内容】
(1)按实验线路连接图进行连接。按照实验线路连接图分别配置各台计算机IP 地 址。
在这里插入图片描述
(2) 按照实验线路连接图,在SW1和SW2上分别完成VLAN配置,并在VLAN中添加相应的端口成员,同时配置Trunk端口。同时测试各计算机之间是否可以相互ping 通。

Switch>en
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#exit
Switch(config)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface Fa0/1
Switch(config-if)#switchport access vlan 10
Switch(config-if)#exit
Switch(config)#interface Fa0/2
Switch(config-if)#switchport access vlan 20
Switch(config-if)#exit
Switch(config)#exit
Switch>en
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#interface gigabitEthernet 1/1
Switch(config-if)#switchport mode trunk
Switch(config-if)#switchport trunk allowed vlan 10,20
Switch(config-if)#exit
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console

(3) 在L3Switch上创建VLAN10和VLAN20,并配置VLAN10的虚接口IP地址为 192.168.10.1,配置VLAN20的虚接口IP地址为192.168.20.1,配置F0/1和F0/2为 Trunk端口。

Switch>en
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
Switch(config)#interface range fastEthernet 0/1 - 2
Switch(config-if-range)#switchport trunk encapsulation dot1q
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#exit
Switch(config)#interface vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.10.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.20.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console

(4)完成以上配置内容后,在L3Switch上使用show ip route命令,可以查看到 192.168.10.0/24和192.168.20.0/24网络的直连路由,接口分别为VLAN10和VLAN20。 同时各计算机之间可以相互ping通。

Switch#show ip route
Switch#
Switch#config t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#interface gigabitEthernet 0/1
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#interface gigabitEthernet 0/2
Switch(config-if)#switchport trunk encapsulation dot1q
Switch(config-if)#switchport mode trunk
Switch(config-if)#exit
Switch(config)#ip routing
Switch(config)#exit
Switch#
%SYS-5-CONFIG_I: Configured from console by console
Switch#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
Switch(vlan)#vlan 10 name VLAN10
VLAN 10 modified:
    Name: VLAN10
Switch(vlan)#vlan 20 name VLAN20
VLAN 20 modified:
    Name: VLAN20
Switch(vlan)#

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

【实验问题】
1. VLAN10 的数据包在三层交换机 L3Switch 上是如何被转发的?
VLAN10的主机将一系列数据发给默认网关。三层交换机的VLAN10的端口接受到主机发来的数据包,三层交换机的第三层引擎收到数据包,在转发数据包前用VLAN20的主机MAC地址作为发送帧的目标MAC地址来封装数据帧,同时将目的IP地址与下一跳MAC 地址的映射关系记录在高速缓存中。VLAN10发送给VLAN20后续的数据后续的数据包直接由三层交换机的MAC处理,直接在第二层封装转发,快速转发数据包,这叫一次路由、多次转发。

2.在三层交换机 L3Switch 上配置 VLAN 虚接口的作用是什么?
在两个不同PC 进行通信时会在三层交换机进行数据交换,实现VLAN间的通信。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值