一、实验目的
通过本实验,可以掌握以下技能:
- VLAN间路由
二、设备需求
- Cisco路由器1台, 交换机1台
- 2台PC机,以及Console电缆及转接器
三、拓扑结构及配置说明
各路由器使用的接口及其编号见图所示的标注,各接口IP地址分配如下:
- PC0-sjt:192.168.1.2 默认网关192.168.1.1
- PC1-sjt:192.168.0.2 默认网关192.168.0.1
- Router1-sjt:Fa0/0.14 192.168.0.1 Fa0/0.15 192.168.1.1
- SW1:Fa2/1 VLAN14 Fa1/1 VLAN15
四、实验配置文档
1.PC配置
PC0-sjt:
PC1-sjt:
2.交换机SW1配置
Switch>enable
Switch#conf
Switch#configure ter
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostn
Switch(config)#hostname SW1-sjt
SW1-sjt(config)#exit
SW1-sjt#
%SYS-5-CONFIG_I: Configured from console by console
SW1-sjt#vl
SW1-sjt#vlan da
SW1-sjt#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.
SW1-sjt(vlan)#vlan 14
VLAN 14 added:
Name: VLAN0014
SW1-sjt(vlan)#vlan 15
VLAN 15 added:
Name: VLAN0015
SW1-sjt(vlan)#exit
APPLY completed.
Exiting....
SW1-sjt#
SW1-sjt#conf
SW1-sjt#configure ter
SW1-sjt#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
SW1-sjt(config)#in
SW1-sjt(config)#interface F
SW1-sjt(config)#interface FastEthernet 1/1
SW1-sjt(config-if)#sw
SW1-sjt(config-if)#switchport ac
SW1-sjt(config-if)#switchport access v
SW1-sjt(config-if)#switchport access vlan 14
SW1-sjt(config-if)#exit
SW1-sjt(config)#int
SW1-sjt(config)#interface F
SW1-sjt(config)#interface FastEthernet 2/1
SW1-sjt(config-if)#sw
SW1-sjt(config-if)#switchport ac
SW1-sjt(config-if)#switchport access vl
SW1-sjt(config-if)#switchport access vlan 15
SW1-sjt(config-if)#exit
SW1-sjt(config)#in
SW1-sjt(config)#interface F
SW1-sjt(config)#interface FastEthernet 0/1
SW1-sjt(config-if)#sw
SW1-sjt(config-if)#switchport mo
SW1-sjt(config-if)#switchport mode tr
SW1-sjt(config-if)#switchport mode trunk
SW1-sjt(config-if)#end
SW1-sjt#
%SYS-5-CONFIG_I: Configured from console by console
SW1-sjt#
3.配置路由器Router
Router>en
Router>enable
Router#conf
Router#configure ter
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#int
Router(config)#interface F
Router(config)#interface FastEthernet 0/0
Router(config-if)#no shut
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#exit
Router(config)#int
Router(config)#interface F
Router(config)#interface FastEthernet 0/0.14
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.14, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.14, changed state to up
Router(config-subif)#en
Router(config-subif)#encapsulation do
Router(config-subif)#encapsulation dot1Q 14
Router(config-subif)#ip address 192.168.0.1 255.255.255.0
Router(config-subif)#exit
Router(config)#int
Router(config)#interface F
Router(config)#interface FastEthernet 0/0.15
Router(config-subif)#
%LINK-5-CHANGED: Interface FastEthernet0/0.15, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.15, changed state to up
en
Router(config-subif)#encapsulation d
Router(config-subif)#encapsulation dot1Q 15
Router(config-subif)#ip address 192.168.1.1 255.255.255.0
Router(config-subif)#exit
Router(config)#
五、验证实验结果
1.show ip route
该命令显示路由器的IP路由选择表,详细指出了路由器是如何获悉网络和发现路由的,该命令如下:
2.show vlan
3.ping 指令的使用
PC0-sjt去pingPC1-sjt,成功ping通
PC1-sjt去pingPC0-sjt,成功ping通
六、实验总结
- 学习了VLAN以及如何配置VLAN
- 了解了单臂路由器VLAN间路由,并学会了如何配置单臂路由器VLAN间路由
- 单臂路由器路由器最重要的就是Trunk链路,所以一定要在指定接口设置中继
七、附件
下面给出该实验的文件
链接:https://pan.baidu.com/s/1ouJDZgqMEfU8bnseV57w8g 密码:5ls6