首页 | 互联网 | IT动态 | IT培训 | Cisco | Windows | Linux | Java | .Net | Oracle | 软件测试 | C/C++ | 嵌入式开发 | 存储世界 | 服务器
网络设备 | IDC | 安全 | 求职招聘 | 数字网校 | 网页设计 | 技术专题 | 电子书下载 | 教学视频 | 网页设计 | 平面设计 | 搜索 | 博客 | 论坛
欢迎光临中国IT实验室思科频道
您现在的位置: 中国IT实验室 >> Cisco >> 交换技术 >> 三层交换 >> 文章正文

三层交换机实现VLAN互通实例

文章来源ChinaItLab 作者佚名 更新时间2007-9-13 保存本文保存本文 推荐给好友推荐给好友 收藏本页收藏本页

  随着企业内部流量的逐步增大,使用路由器的独臂路由功能来实现不同vlan间互访已不能满足企业用户的需求。这时我们可以使用转发速度较快的三层交换机来实现这些功能。通过在三层交换上配置相应的vlan地址(即网关地址),让不同vlan的用户通过三层交换的中继链路实现快速的互访。

  实现步骤

  在2层交换机上配置VLAN

SW-2L(config)#vlan 2
SW-2L(config-vlan)#vlan 3
SW-2L(config-vlan)#exit

  配置所需要的接口加入到vlan中

SW-2L(config)#interface range f0/2
SW-2L(config-if-range)#switchport mode access
SW-2L(config-if-range)#switchport access vlan 2
SW-2L(config)#interface range f0/3
SW-2L(config-if-range)#switchport mode access
SW-2L(config-if-range)#switchport access vlan 3

  在2层交换机上配制Trunk接口

SW-2L(config)#interface f0/1
SW-2L(config-if)#switchport mode trunk

  在3层交换机上配置与2层交换机相同的VLAN(配置步骤与方法相同,也可以配置一台交换机为VTP域服务器,其它交换机为VTP域客户端来自动学习vlan信息)

SW-3L(config)#vlan database
SW-3L(config-vlan)#vlan 2
SW-3L(config-vlan)#vlan 3
SW-3L(config-vlan)#exit

  在3层交换机上配置中继接口

SW-3L(config)#interface f0/1
SW-3L(config-if)#switchport  trunk encapsulation dot1q
SW-3L(config-if)#switchport mode trunk

  在3层交换机上启动路由

  SW-3L(config)#ip routing

  v在3层交换机上配置各VLAN的IP地址

SW-3L(config)#interface vlan 1
SW-3L(config-if)#ip address 192.168.1.1 255.255.255.0
SW-3L(config-if)#no shut
SW-3L(config)#interface vlan 2
SW-3L(config-if)#ip address 192.168.2.1 255.255.255.0
SW-3L(config-if)#no shut
SW-3L(config)#interface vlan 3
SW-3L(config-if)#ip address 192.168.3.1 255.255.255.0
SW-3L(config-if)#no shut

  在3层交换机上查看路由表

SW-3L#show ip route
SW-3L #sh ip route
Codes: C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, Vlan1
C    192.168.2.0/24 is directly connected, Vlan2
C    192.168.3.0/24 is directly connected, Vlan3

  在主机192.168.2.2上ping 192.168.3.2

  在这里,主机也是用路由器模拟的,这里举一台的配置为例:

Router#conf t
Router(config)#host PC2
PC2(config)#int f0/2
PC2(config-if)#no sw
PC2(config-if)#ip add 192.168.2.2 255.255.255.0
PC2(config-if)#no shut
PC2(config-if)#exit
PC2(config)#ip default-ga 192.168.2.1
PC2(config)#no ip routing
PC2#ping 192.168.3.2

【责编:Kittoy】
中国IT教育
相关产品和培训
文章评论
 友情推荐精华
 专题推荐

 ·巧用网络流量 打造健康内网
 ·无线路由器设置从入门到精通
 ·企业网管如何部署你的网络监控系统?
 ·负载均衡技术方案攻略
 ·中国IT实验室2007年技术热点盘点
 ·利用路由实现VPN的配置方法
 ·让你的局域网网速更上一层楼
 ·小命令大作用---Ping
 ·OSPF路由协议专题
 ·三层交换技术专题
 今日更新
 认证培训
 频道精选
 思科频道导航