今天是上班的第一天,用了一下Cisco Packet Tracer 并做了一下基于多层交换的VLAN间路由,下面给大家分享一下:

 
一、拓扑图:
 
 
二、详细配置及说明:
1
、两台PCIP的配置:
 

 
 
2 、交换机的配置:
Switch(config)#ip routing(启用交换机的三层路由功能)
Switch(config)#vlan 10(创建一个VLAN 10
Switch(config-vlan)#name cisco (并为VLAN 10创建一个名字为cisco
Switch(config-vlan)#int vlan 10 (启用交换机的VLAN 10SVI接口)
Switch(config-if)#no sh
Switch(config-if)#ip add 192.168.1.1 255.255.255.0(为VLAN 10SVI接口配置IP,其为PC1的网关)
Switch(config-if)#int f0/11 (进入交换机F0/11接口)
Switch(config-if)#switchport access vlan 10 (把此接口加入到VLAN 10 当中)
 
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name microsoft
Switch(config-if)#int vlan 20
Switch(config-if)#no sh
Switch(config-if)#ip add 192.168.2.1 255.255.255.0
Switch(config-if)#int f0/13
Switch(config-if)#switchport access vlan 20
 
三、查看 VLAN的配置:
 
Switch#sh vlan bri
 
VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/12, Fa0/14
                                                Fa0/15, Fa0/16, Fa0/17, Fa0/18
                                                Fa0/19, Fa0/20, Fa0/21, Fa0/22
                                                Fa0/23, Fa0/24, Gig0/1, Gig0/2
10   cisco                            active    Fa0/11
20   microsoft                        active    Fa0/13
1002 fddi-default                     active   
1003 token-ring-default               active   
1004 fddinet-default                  active   
1005 trnet-default                    active    
Switch#
 
四、在交换机上查看一下路由表:
 
Switch#sh ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
       i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
       * - candidate default, U - per-user static route, o - ODR
       P - periodic downloaded static route
 
Gateway of last resort is not set
 
C    192.168.1.0/24 is directly connected, Vlan10
C    192.168.2.0/24 is directly connected, Vlan20(到达客户端网络的路由条目,其出口为本地的SVI接口,也就是虚拟VLAN接口)
 
五、在PC1PC2上使用ping 命令查看一下VLAN 10VLAN 20这两个VLAN间能否互相访问,发现能够ping 通:
 

本文转自wxs-163 51CTO博客,原文链接:http://blog.51cto.com/supercisco/277707